stackedarea.php
Back to Chart Graphics
setPlotArea(50, 30, 240, 140)->setBackground(0xffffff);
# Add a legend box at (50, 185) (below of plot area) using horizontal layout. Use 8pt Arial font
# with Transparent background.
$c->addLegend(50, 185, false, "", 8)->setBackground(Transparent);
# Add a title box to the chart using 8pt Arial Bold font, with yellow (0xffff40) background and a
# black border (0x0)
$c->addTitle("Sales Volume", "Arial Bold", 8)->setBackground(0xffff40, 0);
# Set the y axis label format to US$nnnn
$c->yAxis->setLabelFormat("US\${value}");
# Set the labels on the x axis.
$c->xAxis->setLabels($labels);
# Display 1 out of 2 labels on the x-axis. Show minor ticks for remaining labels.
$c->xAxis->setLabelStep(2, 1);
# Add an stack area layer with three data sets
$layer = $c->addAreaLayer2(Stack);
$layer->addDataSet($data0, 0x4040ff, "Store #1");
$layer->addDataSet($data1, 0xff4040, "Store #2");
$layer->addDataSet($data2, 0x40ff40, "Store #3");
# Output the chart
$viewer = new WebChartViewer("chart1");
$viewer->setChart($c, SVG);
# Include tool tip for the chart
$viewer->setImageMap($c->getHTMLImageMap("", "",
"title='{dataSetName} sales at hour {xLabel}: US\${value}K'"));
?>
Stacked Area Chart
Stacked Area Chart
renderHTML(); ?>