/php/ChartDirector/phpdemo/jsclick.php
Back to Chart Graphics
addTitle("Annual Revenue for Star Tech", "Times New Roman Bold Italic", 18);
# Set the plotarea at (60, 40) and of size 480 x 280 pixels. Use a vertical gradient color from
# light green (eeffee) to dark green (008800) as background. Set border and grid lines to white
# (ffffff).
$c->setPlotArea(60, 40, 480, 280, $c->linearGradientColor(60, 40, 60, 280, 0xeeffee, 0x008800), -1,
0xffffff, 0xffffff);
# Add a multi-color bar chart layer using the revenue data.
$layer = $c->addBarLayer3($revenue);
# Set cylinder bar shape
$layer->setBarShape(CircleShape);
# Add extra field to the bars. These fields are used for showing additional information.
$layer->addExtraField2($grossMargin);
$layer->addExtraField2($backLog);
# Set the labels on the x axis.
$c->xAxis->setLabels($labels);
# In this example, we show the same scale using both axes
$c->syncYAxis();
# Set the axis line to transparent
$c->xAxis->setColors(Transparent);
$c->yAxis->setColors(Transparent);
$c->yAxis2->setColors(Transparent);
# Set the axis label to using 8pt Arial Bold as font
$c->yAxis->setLabelStyle("Arial Bold", 8);
$c->yAxis2->setLabelStyle("Arial Bold", 8);
$c->xAxis->setLabelStyle("Arial Bold", 8);
# Add title to the y axes
$c->yAxis->setTitle("USD (millions)", "Arial Bold", 10);
$c->yAxis2->setTitle("USD (millions)", "Arial Bold", 10);
# Output the chart
$viewer = new WebChartViewer("chart1");
$viewer->setChart($c, SVG);
# Client side Javascript to show detail information "onmouseover"
$showText = "onmouseover='showInfo(\"{xLabel}\", {value}, {field0}, {field1});' ";
# Client side Javascript to hide detail information "onmouseout"
$hideText = "onmouseout='showInfo(null);' ";
# "title" attribute to show tool tip
$toolTip = "title='{xLabel}: US\$ {value|0}M'";
# Create an image map for the chart
$imageMap = $c->getHTMLImageMap("xystub.php", "", $showText . $hideText . $toolTip);
# Assign the image map to the chart
$viewer->setImageMap($imageMap);
?>
Javascript Clickable Chart
Javascript Clickable Chart
renderHTML() ?>