The #getDataTable method only returns a DataTable object if the chart is fed one - which it isn't in the case of Dashboards. What is actually returned is a DataView object, so what you want to do is this:
var new_sc = chart.getDataTable().toDataTable(); On Friday, July 27, 2012 10:02:05 PM UTC-4, Reepsy wrote: > > I have a scatter plot in a dashboard with two controls. When a user > interacts with the controls and changes the chart, I wish to amend some > other elements on my page with this data, outside of the dashboard. So I am > doing something like this: > > /* current scatter chart data table */ > sc = chart.getDataTable(); > > Where 'chart' is the scatter plot I mentioned. I can now query the data > like so: > > sc.getNumberOfRows(); > > And get data out without issue. But to make the changes on the page I > talked about, I wish to make some edits first (addColumn, setCell). So it > was my hope to create a new DataTable() instance, like so: > > new_sc = new google.visualization.DataTable(sc); > > But that returns an empty table. If I make it a DataView, it works fine: > > new_sc = new google.visualization.DataView(sc); > > But then it is read only, and I cannot manipulate it. How can I take the > getDataTable() result and make it into a DataTable I can do addColumn, > setCell, etc.? > > -- You received this message because you are subscribed to the Google Groups "Google Visualization API" group. To view this discussion on the web visit https://groups.google.com/d/msg/google-visualization-api/-/5_KF3XRYxUQJ. 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.
