[visualization-api] Use specific datable rows or columns to draw a visualization

55 views
Skip to first unread message

Renato Beserra

unread,
Jan 9, 2012, 9:58:52 AM1/9/12
to Google Visualization API
Is it possible to ignore some rows or columns of a datatable in some visualization? I have a set of data which is presented as a table, and a subset of this data should be presented as a chart.

I had to create two different data tables to achieve this behavior. Is it possible to present the subset as a chart without creating a new dataTable?

Thanks.

--
Renato Beserra Sousa

asgallant

unread,
Jan 9, 2012, 10:22:16 AM1/9/12
to google-visua...@googlegroups.com
Absolutely, use a DataView ( http://code.google.com/apis/chart/interactive/docs/reference.html#DataView).  You can use DataTable#getFilteredRows to restrict your rows by whatever criteria you choose and then pass the returned indices to DataView#setRows.  DataView#setColumns allows you to choose which columns to include in the view.  When drawing the chart, pass the DataView object instead of the DataTable to the draw call.

Renato Beserra

unread,
Jan 9, 2012, 10:35:53 AM1/9/12
to google-visua...@googlegroups.com
Thank you very much. This is exactly what I need!

2012/1/9 asgallant <drew_g...@abtassoc.com>
Absolutely, use a DataView ( http://code.google.com/apis/chart/interactive/docs/reference.html#DataView).  You can use DataTable#getFilteredRows to restrict your rows by whatever criteria you choose and then pass the returned indices to DataView#setRows.  DataView#setColumns allows you to choose which columns to include in the view.  When drawing the chart, pass the DataView object instead of the DataTable to the draw call.

--
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/-/JVoQTYQn848J.
To post to this group, send email to google-visua...@googlegroups.com.
To unsubscribe from this group, send email to google-visualizati...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-visualization-api?hl=en.



--
Renato Beserra Sousa
Reply all
Reply to author
Forward
0 new messages