getDataTable functionality and dashboards

21 views
Skip to first unread message

Richard Doan

unread,
Oct 5, 2016, 12:20:34 PM10/5/16
to Google Visualization API
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

dashboard.draw(data);

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.



Reply all
Reply to author
Forward
0 new messages