ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  Tooltip on zone
Posted by Treavor Gagne on Oct-26-2021 06:02
Hello,

Is it possible to add a tooltip to a Axis.addZone() area on an XYchart. I am working in php.

Treavor

  Re: Tooltip on zone
Posted by Peter Kwan on Oct-27-2021 05:23
Hi Treavor,

Yes, you can turn zone into a hot spot by generating an HTML image map (<area> tag) for the zone. The code structure is like (the following is in ChartDirector 7 code style):

.... create the chart as usual ....

#After adding all the data to the chart, we can auto-scale the axis, so that we
#can determine the position of the data points.
$c->layoutAxes();

#This is just a standard HTML area tag, creating using the coordinates of the zone
#(assume the zone is from y = 50 to y = 80)
$zoneImageMap = sprintf("<area shape='rect' coords='%d,%d,%d,%d' title='my tooltip here'>",
$c->getPlotArea()->getLeftX(), $c->getYCoor(50), $c->getPlotArea()->getRightX(), $c->getYCoor(80));

# Output the chart as usual
$viewer = new WebChartViewer("chart1");
$viewer->setChart($c, SVG);

# Output the image map - append the zoneImageMap to the data point image map
$viewer->setImageMap($c->getHTMLImageMap("", "", "title='Temperature at {x}:00 = {value} C'") . $zoneImageMap);

Regards
Peter Kwan