cdmltooltip.php
Back to Chart Graphics
setPlotArea(30, 40, 300, 300, $c->linearGradientColor(0, 30, 0, 330, 0xf9fcff, 0xaaccff), -1,
0xc0c0c0, 0xc0c0c0, 0xc0c0c0);
# Add a legend box at the right side of the plot area. Use 10pt Arial Bold font and set background
# and border colors to Transparent.
$c->addLegend($c->getPlotArea()->getRightX() + 20, $c->getPlotArea()->getTopY(), true,
"Arial Bold Italic", 10)->setBackground(Transparent);
# Add a title to the chart using 18pt Times Bold Itatic font
$c->addTitle("CDML Tooltip Demonstration", "Times New Roman Bold Italic", 18);
# Set the axes line width to 3 pixels, and ensure the auto axis labels are integers.
$c->xAxis->setWidth(3);
$c->yAxis->setWidth(3);
$c->yAxis->setMinTickInc(1);
$c->yAxis->setMinTickInc(1);
# Add a scatter chart layer with 19 pixel red (ff3333) sphere symbols. Use default CDML tooltip
# style.
$layer0 = $c->addScatterLayer($dataX0, $dataY0, "Default CDML Tooltip", GlassSphere2Shape, 19,
0xff3333);
$layer0->setHTMLImageMap("", "", "title='<*cdml*>{dataSetName}<*br*>X = {x}, Y = {value}'");
# Add a scatter chart layer with 19 pixel green (33ff33) sphere symbols. Cconfigure the CDML tooltip
# to use a background background with text of different colors and fonts.
$layer1 = $c->addScatterLayer($dataX1, $dataY1, "Dark Style Tooltip", GlassSphere2Shape, 19,
0x33ff33);
$layer1->setHTMLImageMap("", "",
"title='<*cdml style=\"background:#000000; padding:5px; border-radius:3px; font-size:8pt\"*>".
"<*span style=\"font:bold italic 100% Arial; color:#FFFF00\"*>{dataSetName}<*/span*><*br*>".
"<*span style=\"font:bold 100% Arial; color:#FFFFFF\"*>X = {x}, Y = {value}<*/span*>'");
# Add a scatter chart layer with 19 pixels sky blue (66ccff) symbols. Configure the CDML tooltip to
# ue a translucent background.
$layer2 = $c->addScatterLayer($dataX2, $dataY2, "Translucent Tooltip", GlassSphere2Shape, 19,
0x66ccff);
$layer2->setHTMLImageMap("", "",
"title='<*cdml class=\"translucentToolTip\"*><*b*><*u*>{dataSetName}<*/u*><*/b*><*br*>X = ".
"{x}, Y = {value}'");
# Add a scatter chart layer with 19 pixels sky blue (ffff00) symbols. Use standard tooltips provided
# by the GUI framework.
$layer3 = $c->addScatterLayer($dataX3, $dataY3, "Classical Tooltip", GlassSphere2Shape, 19, 0xffff00
);
$layer3->setHTMLImageMap("", "", "title='[{dataSetName}] X = {x}, Y = {value}'");
# Output the chart
$viewer = new WebChartViewer("chart1");
$viewer->setChart($c, SVG);
# Include tool tip for the chart
$viewer->setImageMap($c->getHTMLImageMap(""));
?>
CDML Tooltips
CDML Tooltips
renderHTML(); ?>