This example contains three zones in the plot area background, colored as red, green and blue.
The red region is the background color of the plot area, configured using
PolarChart.setPlotArea.
The green and blue region are actually spline area layers. The data points are equally spaced and at equal distances from the center. By joining the data points with spline curves, the resulting area will look circles.
[File: phpdemo/polarzones.php".]
setBackground($c->patternColor(array(0xffffff, 0xe0e0e0), 2), 0, 1);
#Add a title to the chart using 16 pts Arial Bold Italic font. The title text is
#white (0xffffff) on 2 pixel pattern background
$titleObj = $c->addTitle("Chemical Concentration", "arialbi.ttf", 16, 0xffffff);
$titleObj->setBackground($c->patternColor(array(0x0, 0x80), 2));
#Set center of plot area at (200, 240) with radius 145 pixels. Set background
#color to 0xffcccc
$c->setPlotArea(200, 240, 145, 0xffcccc);
#Set the grid style to circular grid
$c->setGridStyle(false);
#Set the radial axis label format
$radialAxisObj = $c->radialAxis();
$radialAxisObj->setLabelFormat("{value} ppm");
#Add a legend box at (200, 30) top center aligned, using 9 pts Arial Bold font.
#with a black border, and 1 pixel 3D border effect.
$legendBox = $c->addLegend(200, 30, false, "arialbd.ttf", 9);
$legendBox->setAlignment(TopCenter);
#Add a legend key to represent the red (0xffcccc) zone
$legendBox->addKey("Over-Absorp", 0xffcccc);
#Add a spline area layer using circular data to represent the green (0xaaffaa)
#and blue (0xccccff) zones
$c->addSplineAreaLayer($zone1, 0xaaffaa, "Normal");
$c->addSplineAreaLayer($zone0, 0xccccff, "Under-Absorp");
#Add a blue (0x80) spline line layer with line width set to 3 pixels
$splineLineLayerObj = $c->addSplineLineLayer($data0, 0x80);
$splineLineLayerObj->setLineWidth(3);
#Set the labels to the angular axis as spokes. Set the font size to 10 pts
#fonts.
$angularAxisObj = $c->angularAxis();
$labelsObj = $angularAxisObj->setLabels($labels);
$labelsObj->setFontSize(10);
#output the chart
header("Content-type: image/png");
print($c->makeChart2(PNG));
?> |
© 2004 Advanced Software Engineering Limited. All rights reserved.