Copy DataTable

457 views
Skip to first unread message

Rune V. Sjoen

unread,
Nov 26, 2009, 9:22:40 AM11/26/09
to Google Visualization API
Is there a simpler way to make a copy of a DataTable rather than
manually looping through and adding rows/columns ?

What I want is to make a single query of a rather large datatable, and
use this table to do multiple visualizations.
However each visualization needs different changes done to the data.

Viz Kid

unread,
Nov 26, 2009, 12:36:38 PM11/26/09
to google-visua...@googlegroups.com

The simplest way to clone a DataTable is to use it's clone method as documented in the API.
An alternative way is to use the json constructor from the original table's json which you can get by using the toJSON() method of DataTable (also documented there).

If the table is big, you might consider using different views on the same table in order to save memory, depends on the operations that each of your specific visualizations requires. To learn more on how to create a DataView of a given DataTable and what are the possible views, take a look at the documentation.

Best,
  Viz Kid


--

You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
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.



Rune V. Sjoen

unread,
Dec 1, 2009, 8:31:49 AM12/1/09
to Google Visualization API
I have no clue whatsoever how I could have missed that in the API.
Thank you

On Nov 26, 6:36 pm, Viz Kid <viz...@google.com> wrote:
> The simplest way to clone a DataTable is to use it's clone method as
> documented in the
> API<http://code.google.com/apis/visualization/documentation/reference.htm...>
> .
> An alternative way is to use the json constructor from the original table's
> json which you can get by using the toJSON() method of DataTable (also
> documented there).
>
> If the table is big, you might consider using different views on the same
> table in order to save memory, depends on the operations that each of your
> specific visualizations requires. To learn more on how to create a DataView
> of a given DataTable and what are the possible views, take a look at the
> documentation<http://code.google.com/apis/visualization/documentation/reference.htm...>
> .
>
> Best,
>   Viz Kid
>
> On Thu, Nov 26, 2009 at 4:22 PM, Rune V. Sjoen <rvsj...@gmail.com> wrote:
>
> > Is there a simpler way to make a copy of a DataTable rather than
> > manually looping through and adding rows/columns ?
>
> > What I want is to make a single query of a rather large datatable, and
> > use this table to do multiple visualizations.
> > However each visualization needs different changes done to the data.
>
> > --
>
> > You received this message because you are subscribed to the Google Groups
> > "Google Visualization API" group.
> > To post to this group, send email to
> > google-visua...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > google-visualizati...@googlegroups.com<google-visualization-api%2Bunsu...@googlegroups.com>
> > .
Reply all
Reply to author
Forward
0 new messages