CLASS IconPlot (Defined in: jpgraph.php : 7792)

IconPlot
IconPlot() SetAnchor() SetCountryFlag() SetMix() SetPos() SetScale()

Class usage and Overview
Make it possible to add one or several images on top of the background in the graph. This is constructed in the same way as normal plots are created and the images are added as normal with the GRaph::Add() method. It is possoble to specify arbitrary positions as well as mix (blend) and scaling. Example: $icon = new IconPlot('myicon.png',0.5,0.5); .. $graph->Add($icon);

Class Methods

function IconPlot($aFile,$aX,$aY,$aScale,$aMix)
Create a new icon image to be added to the graph

Argument | Default | Description
--- | --- | ---
$aFile | "" | File name of image
$aX | 0 | X-position
$aY | 0 | Y-position
$aScale | 1.0 | Scale
$aMix | 100 | Mixin value

Description
Create a new icon image to be added to the graph. The position can be specified as either absolute coordinates or as fractions of the width and height repsectively. Scale can be an arbitrary floating point number indicating the scaling of the image. The mix values specifies (in percent 1-100) how much of the image should be mixed in on top of the background.

Example

$icon = new IconPlot('myfile.png',0.5,0.5,1,50);

function SetAnchor($aXAnchor,$aYAnchor)
Specify anchor point for image

Argument | Default | Description
--- | --- | ---
$aXAnchor | 'left' | Horizontal anchor
$aYAnchor | 'center' | Verticla anchor

Description
Specify anchor point for image. Horizontal anchor can be "left','center','right' and vertical anchor can be 'top','center','bottom' By default the anchor is the top left corner ('left','top')

Example

$icon->SetAnchor('center','center');

function SetCountryFlag($aFlag,$aX,$aY,$aScale,$aMix,$aStdSize)
Use one of the country flags as icons

Argument | Default | Description
--- | --- | ---
$aFlag |  | Partial or full country name
$aX |  | X-position
$aY |  | Y-position
$aScale |  | Scaleing of image
$aMix |  | Blend factor (0-100)
$aStdSize |  | Which of the flag standard sizes should be used as the original image (1-4)

Description
Use one of the country flags as icons

Example

$icon = new IconPlot();
$icon->SetCountryFlag('norway',0.1,0.1);

function SetMix($aMix)
Specify mix value in percent (0-100) for image-

Argument | Default | Description
--- | --- | ---
$aMix |  | Mix value (0-100)

Description
Specify mix value in percent (0-100) for image. The mix value can also be specified directly in the constructor IconPlot().

Example

$icon->SetMix(50);

function SetPos($aX,$aY)
Specify position for image

Argument | Default | Description
--- | --- | ---
$aX |  | X-position
$aY |  | Y-position

Description
Specify position for image. Position can be specified as either absolute coordinates or as fractions of the width and height. The anchor point in the image can be adjusted with a call to SetAnchor(). By default the anchor point is the top left corner.
See also
IconPlot::SetAnchor

Example

$icon->SetPos(0.5,0.5);

function SetScale($aScale)
Set scaling for image

Argument | Default | Description
--- | --- | ---
$aScale |  | Scale value.

Description
Set scaling for image. This allows you to adjust the size of the image.

Example

$icon->SetScale(0.8);