#!/usr/bin/perl
# Include current script directory in the module path (needed on Microsoft IIS).
# This allows this script to work by copying ChartDirector to the same directory
# as the script (as an alternative to installation in Perl module directory)
use File::Basename;
use lib dirname($0) =~ /(.*)/;
use perlchartdir;
# The labels for the line chart
my $labels = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12",
"13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24"];
# Create an XYChart object of size 600 x 300 pixels, with a light blue (EEEEFF)
# background, black border, 1 pxiel 3D border effect and rounded corners
my $c = new XYChart(600, 500, 0xeeeeff, 0x000000, 1);
$c->setRoundedFrame();
# Set the plotarea at (55, 58) and of size 520 x 195 pixels, with white background.
# Turn on both horizontal and vertical grid lines with light grey color (0xcccccc)
$c->setPlotArea(55, 258, 520, 195, 0xffffff, -1, -1, 0xcccccc, 0xcccccc);
# Add a legend box at (50, 45) (top of the chart) with horizontal layout. Use 9 pts
# Arial Bold font. Set the background and border color to Transparent.
$c->addLegend2(55, 45, 5, "arialbd.ttf", 9)->setWidth(520);
# Add a title box to the chart using 15 pts Times Bold Italic font, on a light blue
# (CCCCFF) background with glass effect. white (0xffffff) on a dark red (0x800000)
# background, with a 1 pixel 3D border.
$c->addTitle("Application Server Throughput", "timesbi.ttf", 15)->setBackground(
0xccccff, 0x000000, perlchartdir::glassEffect());
# Add a title to the y axis
$c->yAxis()->setTitle("MBytes per hour");
# Set the labels on the x axis.
$c->xAxis()->setLabels($labels);
# Display 1 out of 3 labels on the x-axis.
$c->xAxis()->setLabelStep(3);
# Add a title to the x axis
$c->xAxis()->setTitle("Jun 12, 2006");
# Add a line layer to the chart
my $layer = $c->addLineLayer2();
my $r = new RanSeries(127);
for (my $i = 0; $i < 56; ++$i) {
$layer->addDataSet($r->getSeries(25, 100, -15, 15), -1, "Line $i");
}
# Output the chart
binmode(STDOUT);
print "Content-type: image/png\\n\\n";
print $c->makeChart2($perlchartdir::PNG);
|