Search code examples
javascriptchartsgoogle-visualization

Selected rowid in Google ChartRangeFilter on Timeline chart after zooming


I have a Google Timeline chart with ChartRangeFilter. The ChartRangeFilter is able to zoom and pan across the series. I am handling "select" event of the Timeline chart. I zoomed into a specific area in the series using the ChartRangeFilter and tried to get the selected item. The first item in the zoomed series has rowId as 0, instead of actual index of the item in the datatable. How can I get correlate the rowId with the datatable?

var rowId = chartWrapperObj.getChart().getSelection()[0].row;
var selectedValue = dataTable.getValue(rowid, 0);

Solution

  • instead of using the original data table to get the value,
    use the data table from the chart wrapper...

    var rowId = chartWrapperObj.getChart().getSelection()[0].row;
    var selectedValue = chartWrapperObj.getDataTable().getValue(rowid, 0);