setRoundedFrame();
# Set plotarea at (55, 60) with size of 520 x 240 pixels. Use white (ffffff) as background and grey
# (cccccc) for grid lines
$c->setPlotArea(55, 60, 520, 240, 0xffffff, -1, -1, 0xcccccc, 0xcccccc);
# Add a legend box at (55, 58) (top of plot area) using 9pt Arial Bold font with horizontal layout
# Set border and background colors of the legend box to Transparent
$legendBox = $c->addLegend(55, 58, false, "Arial Bold", 9);
$legendBox->setBackground(Transparent);
# Reserve 10% margin at the top of the plot area during auto-scaling to leave space for the legends.
$c->yAxis->setAutoScale(0.1);
# Add a title to the chart using 15pt Times Bold Italic font. The text is white (ffffff) on a blue
# (0000cc) background, with glass effect.
$title = $c->addTitle("Monthly Revenue for Year 2000/2001", "Times New Roman Bold Italic", 15,
0xffffff);
$title->setBackground(0x0000cc, 0x000000, glassEffect(ReducedGlare));
# Add a title to the y axis
$c->yAxis->setTitle("Month Revenue (USD millions)");
# Set the labels on the x axis. Draw the labels vertical (angle = 90)
$c->xAxis->setLabels($labels)->setFontAngle(90);
# Add a vertical mark at x = 17 using a semi-transparent purple (809933ff) color and Arial Bold
# font. Attached the mark (and therefore its label) to the top x axis.
$mark = $c->xAxis2->addMark(17, 0x809933ff, "Merge with Star Tech", "Arial Bold");
# Set the mark line width to 2 pixels
$mark->setLineWidth(2);
# Set the mark label font color to purple (0x9933ff)
$mark->setFontColor(0x9933ff);
# Add a copyright message at (575, 295) (bottom right of plot area) using Arial Bold font
$copyRight = $c->addText(575, 295, "(c) Copyright Space Travel Ltd", "Arial Bold");
$copyRight->setAlignment(BottomRight);
# Add a line layer to the chart
$layer = $c->addLineLayer();
# Set the default line width to 3 pixels
$layer->setLineWidth(3);
# Add the data sets to the line layer
$layer->addDataSet($data0, -1, "Enterprise");
$layer->addDataSet($data1, -1, "Consumer");
# Output the chart
$viewer = new WebChartViewer("chart1");
$viewer->setChart($c, SVG);
# Create an image map for the chart
$chartImageMap = $c->getHTMLImageMap("xystub.php", "",
"title='{dataSetName} @ {xLabel} = USD {value|0} millions'");
# Create an image map for the legend box
$legendImageMap = $legendBox->getHTMLImageMap(
"javascript:popMsg('the legend key [{dataSetName}]');", " ",
"title='This legend key is clickable!'");
# Obtain the image map for the title
$titleImageMap = "getImageCoor() .
" href='javascript:popMsg(\"the chart title\");' title='The title is clickable!'>";
# Obtain the image map for the mark
$markImageMap = "getImageCoor() .
" href='javascript:popMsg(\"the Merge with Star Tech mark\");' title='The Merge with Star ".
"Tech text is clickable!'>";
# Obtain the image map for the copyright message
$copyRightImageMap = "getImageCoor() .
" href='javascript:popMsg(\"the copyright message\");' title='The copyright text is ".
"clickable!'>";
# Get the combined image map
$imageMap = $chartImageMap . $legendImageMap . $titleImageMap . $markImageMap . $copyRightImageMap;
# Assign the image map to the chart
$viewer->setImageMap($imageMap);
?>
Custom Clickable Objects
Custom Clickable Objects
In the following chart, the lines, legend keys, title, copyright, and the "Merge
with Star Tech" text are all clickable!
renderHTML() ?>