I'm not sure I understand completely what the issue is, but when dealing with selection events you should resolve the index of the selected row/column against the same table that was used to draw the chart where selection occurred.
In a dashboard, the input datatable that you pass to dashboard.draw() is processed by the controls that are part of the dashboard and then ultimately served to the charts for drawing (after all the constraints defined by the controls were applied). So if a chart fires a selection event and you resolve the row/column index contained in the event against the datatable you initialized the dashboard with, it probably won't work because any control in between might have filtered out some of the rows, therefore altering their indexes. The correct way to figure out the selected row is to ask the chart itself for the Datatable it was drawn with, and use that instead. In your example 1, if barChart fires a selection event, use barChart.getDataTable() to retrieve the table the chart was drawn with and resolve the selected row index against that one. Does it make sense? - R. On 28 November 2011 22:25, Roni Biran <[email protected]> wrote: > can you send a non working full scale sample? > > > On Mon, Nov 28, 2011 at 10:04 AM, Tanmoy (Cloud Engineering) < > [email protected]> wrote: > >> I am finding that in case of multiple controls (ControlWrapper) being >> bound to a single chart (ChartWrapper) for a dashboard, the >> getTableRowIndex does not return the correct row number from the >> original DataTable when used to get the row number of selected row >> (getSelection). >> >> If there is only a single control, then it works fine, however if >> there are multiple controls, either specified together (using an >> array) or separately (by chaining bind function) then the row index >> returns incorrectly for the 1st control. >> >> e.g. based on the Google Playground example >> ______________________ >> >> Ex1.) the ChartWrapper - barChart is bound to only 1 control - >> cityPicker >> >> new >> google.visualization.Dashboard(document.getElementById('dashboard')). >> bind(countryPicker, regionPicker). >> bind(regionPicker, cityPicker). >> bind(cityPicker, barChart). >> draw(data); >> } >> >> If a value is selected in countryPicker or regionPicker then the row >> index returned on selected a raw is as per the 'visible' row index and >> NOT the original row index in the DataTable. >> If a value is selected in cityPicker then it selecting a row returns >> the correct row index. >> ______________________ >> >> Ex2.) the ChartWrapper - barChart is bound to multiple controls >> >> new >> google.visualization.Dashboard(document.getElementById('dashboard')). >> bind([countryPicker, regionPicker, cityPicker], >> barChart). >> draw(data); >> } >> >> If a value is selected in countryPicker then getTableRowIndex returns >> INCORRECT row index. >> However, if regionPicker or cityPicker are used, then it returns >> correct row index. >> ______________________ >> >> Ex3.) the ChartWrapper - barChart is bound to multiple controls and >> order is changed >> >> new >> google.visualization.Dashboard(document.getElementById('dashboard')). >> bind([regionPicker, countryPicker, cityPicker], >> barChart). >> draw(data); >> } >> >> If a value is selected in regionPicker then getTableRowIndex returns >> INCORRECT row index. >> However, if countryPicker or cityPicker are used, then it returns >> correct row index. >> >> Any ideas or suggestions are welcome.. >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Google Visualization API" group. >> To post to this group, send email to >> [email protected]. >> To unsubscribe from this group, send email to >> [email protected]. >> For more options, visit this group at >> http://groups.google.com/group/google-visualization-api?hl=en. >> >> > -- > You received this message because you are subscribed to the Google Groups > "Google Visualization API" group. > To post to this group, send email to > [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/google-visualization-api?hl=en. > -- You received this message because you are subscribed to the Google Groups "Google Visualization API" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-visualization-api?hl=en.
