trendline.php
Back to Chart Graphics
setPlotArea(55, 45, 420, 210, 0xffffff, -1, -1, 0xc0c0c0, -1);
# Add a legend box at (55, 25) (top of the chart) with horizontal layout. Use 8pt Arial font. Set
# the background and border color to Transparent.
$c->addLegend(55, 22, false, "", 8)->setBackground(Transparent);
# Add a title box to the chart using 13pt Times Bold Italic font. The text is white (0xffffff) on a
# purple (0x800080) background, with a 1 pixel 3D border.
$c->addTitle("Long Term Server Load", "Times New Roman Bold Italic", 13, 0xffffff)->setBackground(
0x800080, -1, 1);
# Add a title to the y axis
$c->yAxis->setTitle("MBytes");
# Set the labels on the x axis. Rotate the font by 90 degrees.
$c->xAxis->setLabels($labels)->setFontAngle(90);
# Add a line layer to the chart
$lineLayer = $c->addLineLayer();
# Add the data to the line layer using light brown color (0xcc9966) with a 7 pixel square symbol
$lineLayer->addDataSet($data, 0xcc9966, "Server Utilization")->setDataSymbol(SquareSymbol, 7);
# Set the line width to 2 pixels
$lineLayer->setLineWidth(2);
# tool tip for the line layer
$lineLayer->setHTMLImageMap("", "", "title='{xLabel}: {value} MBytes'");
# Add a trend line layer using the same data with a dark green (0x008000) color. Set the line width
# to 2 pixels
$trendLayer = $c->addTrendLayer($data, 0x008000, "Trend Line");
$trendLayer->setLineWidth(2);
# tool tip for the trend layer
$trendLayer->setHTMLImageMap("", "", "title='Change rate: {slope|2} MBytes/per month'");
# Output the chart
$viewer = new WebChartViewer("chart1");
$viewer->setChart($c, SVG);
# include tool tip for the chart
$viewer->setImageMap($c->getHTMLImageMap(""));
?>
Trend Line Chart
Trend Line Chart
renderHTML(); ?>