If you want mouse position, you'll have to ditch the google event hooks and
use standard javascript ones. In order to do so, you'll need something that
gets you access to the contents of the iframe the chart is built in; jQuery
is my favorite method of doing so (and has convenient event hook functions
built in):
/* assumes that chart is your chart object
* hooks the 'mouseover' event of the chart div's iframe's body element
*
* set up after instantiating the chart object but before drawing it
* hooks on the chart's 'ready' event to prevent hooking the mouse events
* before the chart finishes drawing
*/
google.events.addListener(chart, 'ready', function () {
$("#chart_div").find("iframe").contents().find("body").hover(
function(e) {
// mouseEnter handler (like onMouseOver, but events don't fire
for sub elements)
alert("X: " + e.pageX + "\nY: " + e.pageY);
},
function(e) {
// mouseExit handler (like onMouseOut, but events don't fire for
sub elements)
alert("mouseExit");
}
);
});
jQuery has traditional onMouseOver and onMouseOut event handlers as well, if
you prefer them.
--
You received this message because you are subscribed to the Google Groups
"Google Visualization API" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/google-visualization-api/-/YrPl9TaHYUwJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-visualization-api?hl=en.