Identifying the clicked element in a select handler

687 views
Skip to first unread message

Peter Haworth

unread,
Sep 7, 2019, 9:13:03 PM9/7/19
to Google Visualization API
I have a column chart with two data series (Scheduled and Actual) with months along the x axis.  When a bar is clicked, I need to find the month and  data series the clicked bar belongs to, e.g. Scheduled and May. This is to generate a report of the detail making up the bar.  How can I do that?

Ray Thomas

unread,
Sep 8, 2019, 11:28:13 PM9/8/19
to Google Visualization API
Maybe this can help - https://stackoverflow.com/questions/46225912/how-do-i-get-the-information-about-the-selected-bar-in-the-google-charts

In that example, when the bar is clicked, the data row number it belongs to is determined and the information extracted from the data table for that row.

Peter Haworth

unread,
Sep 10, 2019, 7:48:34 PM9/10/19
to Google Visualization API
Thanks, I think I see how that will work for me.  Documenting it here in case it's of use to others.

The code in the link you gave me returns the variables row and column. I can use those to extract what I need from my data table.  The month is in array cc[row][0), and the type (Scheduled or Actual) is in array If[column]['label'].  Or maybe there are API calls I can use to avoid delving so deeply into the data table? 
Reply all
Reply to author
Forward
0 new messages