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

Message ListMessage List     Post MessagePost Message

  getting wrong coord from getHTMLIMageMap
Posted by Youssef on Aug-14-2009 04:47
Attachments:
Hello Peter and all,

I'm having a problem with getHTMLIMageMap results, it's giving me the wrong coords for the hot spots.

the position of the squares on the image are correct but the host spots are not.

Please look at my code and see if you can find the problem.

I really appreciate your help

<?php
require_once("lib/phpchartdir.php");
$c = new XYChart(600, 500);
$c->setPlotArea(75, 40, 400, 400, -1, -1, -1, $c->dashLineColor(0x80000000, DotLine), -1);
$c->yAxis->setTickDensity(40);
$c->xAxis->setTickDensity(40);

// create the Coords
$xCoor = array(1,2,3,1,2,3,1,2,3,1,2,3,1,2,3);
$yCoor = array(1,1,1,2,2,2,3,3,3,4,4,4,5,5,5);
$zCoor = array();

// add scatter layer
$layer = $c->addScatterLayer($xCoor, $yCoor, "", SquareSymbol, 50, -1, -1);//Transparent
$xGridSpaing = 1;
$yGridSpacing = 1;
$layer->setSymbolScale(array_pad(array(), count($zCoor), $xGridSpaing), XAxisScale, array_pad(array(), count($zCoor), $yGridSpacing),YAxisScale);

// get the image map
$imageMap = $c->getHTMLIMageMap("myHandler.php", "x={x}&y={value}");
$layer->setHTMLImageMap("clickable");

// save the image in a session
$chart1URL = $c->makeSession("chart1");

?>

<img src="phpdemo/getchart.php?<?php echo $chart1URL?>" border="0" usemap="#map1">

<map name="map1">
<? echo $imageMap; ?>
</map>





==============
This is the HTML I'm getting, please notes the coord, the represent a dot and not an area. ex: coords="3,247,3,247"  !!!

<img src="phpdemo/getchart.php?img=chart1&id=976047e36a4e2a5fcb5338d3db904beb4a847b0ba8fbb&" border="0" usemap="#map1">

<map name="map1">
<area shape="rect" coords="3,247,3,247" href="myHandler.php?x=3&y=5">
<area shape="rect" coords="2,247,2,247" href="myHandler.php?x=2&y=5">
<area shape="rect" coords="1,247,1,247" href="myHandler.php?x=1&y=5">
<area shape="rect" coords="3,248,3,248" href="myHandler.php?x=3&y=4">
<area shape="rect" coords="2,248,2,248" href="myHandler.php?x=2&y=4">
<area shape="rect" coords="1,248,1,248" href="myHandler.php?x=1&y=4">
<area shape="rect" coords="3,249,3,249" href="myHandler.php?x=3&y=3">
<area shape="rect" coords="2,249,2,249" href="myHandler.php?x=2&y=3">
<area shape="rect" coords="1,249,1,249" href="myHandler.php?x=1&y=3">
<area shape="rect" coords="3,250,3,250" href="myHandler.php?x=3&y=2">
<area shape="rect" coords="2,250,2,250" href="myHandler.php?x=2&y=2">
<area shape="rect" coords="1,250,1,250" href="myHandler.php?x=1&y=2">
<area shape="rect" coords="3,251,3,251" href="myHandler.php?x=3&y=1">

<area shape="rect" coords="2,251,2,251" href="myHandler.php?x=2&y=1">
<area shape="rect" coords="1,251,1,251" href="myHandler.php?x=1&y=1">
</map>
getchart.png

  Re: getting wrong coord from getHTMLIMageMap
Posted by Youssef on Aug-14-2009 13:01
I solved this problem by moving

$chart1URL = $c->makeSession("chart1");

before getHTMLImageMap call. I found the solution in a different thread.

thanks to Peter