|
Tooltips on horizonal bar chart. |
Posted by Ed Sparkes on Feb-17-2012 22:05 |
|
Hi,
I am using the bar chart in horizontal mode and my labels can often be quite large and are
truncated when i display the graph.
E.g. the label "A Very Long Label containing useful Information" appears as "ing useful
Information" which is quite useless especially when you have another label "Another Very
Long Label containing useful Information" as they both end up looking the same on graph
and you dont know which is which
"ing useful Information"
"ing useful Information"
Is there a way of having a tooltip on the xaxis labels such that when you hover you get the
full text.
Thanks, Ed |
Re: Tooltips on horizonal bar chart. |
Posted by Ed Sparkes on Feb-18-2012 00:06 |
|
Hi,
Thought i would add some more info, having had a play around and read of the logs.
I have added another field using
c.addExtraField(newLabels)
created an image map
imageMap = c.getHTMLImageMap("","","")
imageMap = imageMap & c.xAxis().getHTMLImageMap("","","title='{field0}'")
but am confused as to what to do with it. My code just returns the chart using
c.makeChart2(cd.PNG) |
Re: Tooltips on horizonal bar chart. |
Posted by Peter Kwan on Feb-18-2012 00:40 |
|
Hi Ed,
You may refer to the "Clickable Charts" section of the ChartDirector documentation. It includes examples on how to create charts with tooltips.
In brief, if you just need a chart image, then you just need to send the chart image to the browser. If you need tooltips as well, you need to send both the chart image (which is content of type image/png) and the HTML for tooltips (which is content of type text/html) to the browser. According to HTTP standard, contents of different types must be delivered using different HTTP connections. Normally, the HTML must be delivered first so that the browser can see the <IMG> tag, and then the image is delivered.
To do this, your code would need to be restructured to output both types of contents.
In brief, the charting code should be placed in the HTML web page (the page that contains the <IMG> tag). The charting code can then output the HTML tooltips. The charting code cannot output the chart image because it violates the HTTP standard. In the sample code, the image is stored in a session variable using BaseChart.makeSession. The <IMG> tag is set to use the getchart.asp utility to load the chart image from the session variable.
When the browser receives the HTML web page and sees the <IMG> tag, it will use a separate HTTP connection (in a web page, each image - no matter static or dynamic - must be loaded using a separate HTTP connection) to load the image using getchart.asp.
You may refer to the sample code for the exact details.
Hope this can help.
Regards
Peter Kwan |
|