I'm getting two different behaviors from the ChartWrapper method getDataTable. If the ChartWrapper is not in a dashboard, the method returns a reference to the DataTable. Or, if it's in a dashboard, and the dashboard hasn't finished drawing, I get a reference to the DataTable.
If the chart is in a dashboard and the dashboard has finished drawing, getDataTable returns an object that contains arrays of the viewable columns and rows.
For example, the two log statements here show different results.
google.visualization.events.addListener(dashboard, 'ready', function() {
console.log(chartWrapper.getDataTable().toJSON()); // the viewable columns and rows
});
console.log(chartWrapper.getDataTable().toJSON()); // reference to the DataTable
I don't see the differences in functionality here in the documentation.
My first question is, why is this happening?
My second question is this. I would like to get the DataTable before and after filtering. To get the DataTable after filtering, do I have to construct it by taking the original DataTable and removing the rows that have been filtered, that I get from calling getDataTable after the chart is drawn?
Thanks.