markzone.php
Back to Chart Graphics
setPlotArea(80, 28, 300, 200)->setGridColor(Transparent);
# Add a title to the y axis
$textbox = $c->yAxis->setTitle("Temperature");
# Set the y axis title upright (font angle = 0)
$textbox->setFontAngle(0);
# Put the y axis title on top of the axis
$textbox->setAlignment(TopLeft2);
# Add green (0x99ff99), yellow (0xffff99) and red (0xff9999) zones to the y axis to represent the
# ranges 0 - 50, 50 - 80, and 80 - max.
$c->yAxis->addZone(0, 50, 0x99ff99);
$c->yAxis->addZone(50, 80, 0xffff99);
$c->yAxis->addZone(80, 9999, 0xff9999);
# Add a purple (0x800080) mark at y = 70 using a line width of 2.
$c->yAxis->addMark(70, 0x800080, "Alert = 70")->setLineWidth(2);
# Add a green (0x008000) mark at y = 40 using a line width of 2.
$c->yAxis->addMark(40, 0x008000, "Watch = 40")->setLineWidth(2);
# Add a legend box at (165, 0) (top right of the chart) using 8pt Arial font. and horizontal layout.
$legend = $c->addLegend(165, 0, false, "Arial Bold", 8);
# Disable the legend box boundary by setting the colors to Transparent
$legend->setBackground(Transparent, Transparent);
# Add 3 custom entries to the legend box to represent the 3 zones
$legend->addKey("Normal", 0x80ff80);
$legend->addKey("Warning", 0xffff80);
$legend->addKey("Critical", 0xff8080);
# Set the labels on the x axis.
$c->xAxis->setLabels($labels);
# Display 1 out of 3 labels on the x-axis. Show minor ticks for remaining labels.
$c->xAxis->setLabelStep(3, 1);
# Add a 3D bar layer with the given data
$layer = $c->addBarLayer($data, 0xbbbbff);
# Set the bar gap to 0 so that the bars are packed tightly
$layer->setBarGap(0);
# Set the border color of the bars same as the fill color, with 1 pixel 3D border effect.
$layer->setBorderColor(SameAsMainColor, 1);
# Output the chart
$viewer = new WebChartViewer("chart1");
$viewer->setChart($c, SVG);
# Include tool tip for the chart
$viewer->setImageMap($c->getHTMLImageMap("", "", "title='Temperature at {x}:00 = {value} C'"));
?>
Marks and Zones (1)
Marks and Zones (1)
renderHTML(); ?>