|
Problem with dataSetName variable |
Posted by David on Jun-20-2012 03:45 |
|
Hello -
I create two clickable line charts to display on the same web page. The first one works perfectly. The second one does not. I pass in the correct dataSet each time, but the 'dataSetName' variable is stuck on what the dataSetName was for the first chart. Why is that? Below is the code I use to generate the image maps.
Thanks!
legendBox = self.c.addLegend(90, 20, 0, self.TitleFont, 9)
legendBox.setBackground(Transparent)
layer = self.c.addLineLayer2()
layer.setLineWidth(2)
for data in dataSet:
dataSetLayer = layer.addDataSet(data[1], -1, data[0])
chartURL = self.c.makeTmpFile("/tmp/tmpcharts")
chartImageMap = self.c.getHTMLImageMap("createChart.py", "", "title='{dataSetName}:{value|0}; Click to drill down'")
legendImageMap = legendBox.getHTMLImageMap("createChart.py, "",title='{dataSetName}; Click to drill down'")
return (chartURL, chartImageMap , legendImageMap) |
Re: Problem with dataSetName variable |
Posted by Peter Kwan on Jun-20-2012 23:33 |
|
Hi David,
Would you mind to inform me the code you use to display the chart image and to associate the chart image with the image map? It should like:
<img src="....url of first chart..." border="0" usemap="#map1">
<map name="map1">
... image map of first chart ...
</map>
<img src="....url of second chart..." border="0" usemap="#map2">
<map name="map2">
... image map of second chart ...
</map>
Note that "usemap" attribute of the <img> tag and and the "name" attribute of the <map> tag. As according to the HTML standard, each <map> tag must have a unique "name" attribute. (In the above, one map is called "map1", and one map is called "map2".) The <img> tag must use the correct "usemap" attribute so that the browser knows which map is for which image. (In the above code, the <img> for chart 1 uses "#map1", while the <img> for chart 2 uses "#map2" to match with the actual "name" attribute of the <map>.)
Hope this can help.
Regards
Peter Kwan |
Re: Problem with dataSetName variable |
Posted by David on Jun-21-2012 03:32 |
|
Thank you, Peter. This fixed my problem. I was using the same name attribute for both. |
|