Google Visualization Pie Chart onclick event not firing in IE8
I'm using the Google Visua开发者_运维百科lization API to draw a pie chart with some data.
I'm also adding an onclick event, which works perfectly in Chrome. But the event does seem to be firing at all in IE8. No error--it just doesn't fire at all.
The chart renders perfectly in all browsers--but the onclick event is not working in IE8 (and possibly other versions of IE--haven't yet tested).
Any ideas?
var dataTable = new google.visualization.DataTable();
dataTable.addColumn('string');
dataTable.addColumn('number');
$.each(obj_json_data,function(){
dataTable.addRow([this.Name,this.Number]);
});
var options = {cht: 'p3', chs: '600x225', labels:'name', legend:'none',
chds:'0,160', enableEvents:true, chdls:'000000,14'};
var chart = new google.visualization.ImageChart(document.getElementById('chart_container'));
chart.draw(dataTable, options);
// Assign event handler
google.visualization.events.addListener(chart, 'onclick', mouseEventHandler);
function mouseEventHandler(event) {
alert('You just clicked ' + event.region);
}
In line: google.visualization.events.addListener(chart, 'onclick', mouseEventHandler);
Try pointing the listener to the 'select' event instead of the 'onclick' event.
It's not 'onclick', it's 'click' event
精彩评论