The "select" event fires when you click the legend entries. With most
charts, you can distinguish a legend click from a data click by checking
the "row" property of the selected value: data points will have a row
index, legend entries will have a null row.
google.visualization.events.addListener(chart, 'select', function () {
var selection = chart.getSelection();
if (selection.length) {
if (selection[0].row == null) {
// legend entry was clicked
// selection[0].column is the column for the selected series
}
}
});
Note that if you have multi-select enabled, you will have to loop through
the selection to check every element.
On Wednesday, July 9, 2014 7:39:43 PM UTC-4, Kyle Adams wrote:
>
> I'm trying to make different tables appear when a chart's different legend
> entries are clicked. Is there a way to add an event listener to the legend
> entries to do this? I notice that something happens when I click the legend
> entries, so I guess there must be a listener already, but how do I add my
> own?
>
--
You received this message because you are subscribed to the Google Groups
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/d/optout.