linearzonemeter.php
Back to Chart Graphics
setMeter(5, 5, 200, 20, Bottom);
# Set meter scale from 0 - 100
$m->setScale(0, 100);
# Add a title at the bottom of the meter with a 1 pixel raised 3D border
$m->addTitle2(Bottom, "Battery Level", "Arial Bold", 8)->setBackground(Transparent, -1, 1);
# Set 3 zones of different colors to represent Good/Weak/Bad data ranges
$m->addZone(50, 100, 0x99ff99, "Good");
$m->addZone(20, 50, 0xffff66, "Weak");
$m->addZone(0, 20, 0xffcccc, "Bad");
# Add empty labels (just need the ticks) at 0/20/50/80 as separators for zones
$m->addLabel(0, " ");
$m->addLabel(20, " ");
$m->addLabel(50, " ");
$m->addLabel(100, " ");
# Add a semi-transparent blue (800000ff) pointer at the specified value, using triangular pointer
# shape
$m->addPointer($value, 0x800000ff)->setShape(TriangularPointer);
# Output the chart
$viewer = new WebChartViewer("chart1");
$viewer->setChart($m, SVG);
?>
Linear Zone Meter
Linear Zone Meter
renderHTML(); ?>