Skip to content Skip to sidebar Skip to footer

How To Set Event For Google Chart?

Hi I am using Google API to draw chart but I want to set event for each row of this table but I don't know how should I collect this element for example I wanna set event that when

Solution 1:

You can use a "select" event handler to do this:

google.visualization.events.addListener(chart, 'select', function () {
    var selection = chart.getSelection();
    if (selection.length) {
        alert(dataTable.getValue(selection[0].bb, 0) + ' clicked');
    }
});

Please note that the selection info is currently bugged; the selection objects should have row and column properties, but those properties are obfuscated, so for now you have to access the row indices from the bb property. The Timeline visualization sets the column index to null for all selections, so you don't need to worry about that one.

Post a Comment for "How To Set Event For Google Chart?"