Making Google Pie Chart Tooltip clickable

208 views
Skip to first unread message

Manish Kumar

unread,
Dec 14, 2012, 9:05:24 AM12/14/12
to google-visua...@googlegroups.com
Hello,
Can I make my google pie chart tooltip also clickable and showing the same data as it shows for the particular sector of chart.
If it is possible then please suggest me the way for that.
Thanks.

asgallant

unread,
Dec 14, 2012, 12:19:41 PM12/14/12
to google-visua...@googlegroups.com
There is nothing in the API that will do this for you, yet.  I anticipate the dev team will extend the HTML tooltips to PieCharts at some point in the future, though I do not know when that will happen.  When the HTML tooltips become available, you can attach click event handlers to them as normal.  Until then, if this is an urgent matter, it is possible to dig into the SVG/VML code to identify the tooltip, and attach an event handler to it, but doing so is rather complicated and subject to breaking in future versions of the API.

Almir

unread,
Feb 21, 2013, 6:10:33 AM2/21/13
to google-visua...@googlegroups.com
Hello!

How can you attach those listeners? 

asgallant

unread,
Feb 21, 2013, 10:32:48 AM2/21/13
to google-visua...@googlegroups.com
What would you like to attach an event listener too?

Almir

unread,
Feb 22, 2013, 4:19:35 AM2/22/13
to google-visua...@googlegroups.com
Hello!

I have a Pie chart where user can click on slices to display some extra information. The problem is that when tooltip is displaying user can not click on slices. Thats why i want to attach same action to tooltip. Maybe there is a better way?

asgallant

unread,
Feb 22, 2013, 11:03:14 AM2/22/13
to google-visua...@googlegroups.com
You will need two code paths to handle this: 1 for older versions of IE (8 and older) and 1 for all other browsers.  For the IE path, the chart's container will have an iframe inside; you need to get at the contents of the iframe, locate the tooltip element inside the VML code, and attach a click event handler to it.  For the other browser path, the chart's container will have SVG code for the chart; locate the tooltip element in there and attach a click event handler to it.  The tooltip elements are destroyed on mouse out from a pie slice, so you have to recreate the event handlers in an "onmouseover" event handler for the chart (or use some method which will auto attach event handlers to the appropriate elements, such as jQuery's "on" method).
Reply all
Reply to author
Forward
0 new messages