This examples demonstrates using external image files as data symbols. This is achieved by using
DataSet.setDataSymbol2.
[File: phpdemo/customsymbolline.php".]
setPlotArea(60, 45, 360, 170, 0xffffff, -1, -1, 0xc0c0c0, -1);
#Add a legend box at (60, 20) (top of the chart) with horizontal layout. Use 8
#pts Arial Bold font. Set the background and border color to Transparent.
$legendObj = $c->addLegend(60, 20, false, "arialbd.ttf", 8);
$legendObj->setBackground(Transparent);
#Add a title to the chart using 12 pts Arial Bold/white font. Use a 1 x 2 bitmap
#pattern as the background.
$titleObj = $c->addTitle("Information Resource Usage", "arialbd.ttf", 12,
0xffffff);
$titleObj->setBackground($c->patternColor(array(0x40, 0x80), 2));
#Set the labels on the x axis
$c->xAxis->setLabels($labels);
#Reserve 8 pixels margins at both side of the x axis to avoid the first and last
#symbols drawing outside of the plot area
$c->xAxis->setMargin(8, 8);
#Add a title to the y axis
$c->yAxis->setTitle("Population");
#Add a line layer to the chart
$layer = $c->addLineLayer2();
#Add the first line using small_user.png as the symbol.
$dataSetObj = $layer->addDataSet($data0, 0xcf4040, "Users");
$dataSetObj->setDataSymbol2(dirname(__FILE__)."/small_user.png");
#Add the first line using small_computer.png as the symbol.
$dataSetObj = $layer->addDataSet($data1, 0x40cf40, "Computers");
$dataSetObj->setDataSymbol2(dirname(__FILE__)."/small_computer.png");
#Set the line width to 3 pixels
$layer->setLineWidth(3);
#output the chart
header("Content-type: image/png");
print($c->makeChart2(PNG));
?> |
© 2004 Advanced Software Engineering Limited. All rights reserved.