How you go about it depends on whether or not you have set the "forceIFrame" option to false or not (currently defaults to true, will soon default to false) - setting it to true renders the charts in an iFrame, false without the iFrame (in all browsers other than IE < 9). If you have not set the forceIFrame option to false, then use this:
google.visualization.events.addListener(chart, 'ready', function () {
if ($.browser.msie && $.browser.version < 9) {
$('#chart_div').find('iframe').contents().find('group').click(function () {
alert('test');
});
}
else {
$('#chart_div').find('iframe').contents().find('svg').click(function () {
alert('test');
});
}
});
if you have set it to false, then use this:
google.visualization.events.addListener(chart, 'ready', function () { if ($.browser.msie && $.browser.version < 9) { $('#chart_div').find('iframe').contents().find('group').click(function () { alert('test'); }); } else { $('#chart_div').find('svg').click(function () { alert('test'); }); }}); The latter case is recommended, as the default value of the option will change soon anyway.
On Wednesday, September 12, 2012 5:47:48 PM UTC-4, Nate Sanden wrote:
I tried jquery:
$('#dan_basic_chart_1').click(function () {
alert('test');
});
but alert is not firing.
I see a 'select' event but from what I understand that only works when I click a data point, bar or line, etc in a chart.