Contents Previous Next

9.23 Adding icons onto the graph

In addition to the standard background image you can also add an arbitrary number of icons onto the background of the graph. These icons are created with a call to the special Plot class IconPlot.

The image from icons are taken from a file or as one of the builtin country flags.

You may control how much of the icon should be blended into the background by specifying a percentage (1-100). The example below shows how to mix in the picture of "Tux" into the background of a filled line graph. Note: This example uses alpha blending and will therefore require GD2.



Figure 184: Adding an icon into the background [src] 

To specify any of the roughly 200 country flags as an icon you first create an empty Icon and then call the IconPlot::SetCountryFlag() with the appropriate parameters. (See the class reference). This is illustrated below by adding the Icelandic flag into the background as an icon



Figure 185: Adding an icon flag into the background [src] 

Note: Some older versions of PHP pre-4.3.3 using the builtin GD have problems rendering blended images. If you have this problem then you need to upgrade to a more recent version of PHP.


Contents Previous Next