This is exactly what I thought at start. Any way, you can create a JSON
string in the server and convert it to a datatable very simply in your JS
file.
Let's say your server renders a JSON string like this:
{
cols: [
{id: 'task', label: 'Task', type: 'string'},
{id: 'hours', label: 'Hours per Day', type: 'number'},
{id: 'timestamp', label: 'My Date', type: 'date' }
], rows: [
{c:[{v: 'Work'}, {v: 11}, { v: new Date(2011,1,1) }]},
{c:[{v: 'Eat'}, {v: 2}, { v: new Date(2011,1,1) }]},
{c:[{v: 'Commute'}, {v: 2}, { v: new Date(2011,1,1) }]},
{c:[{v: 'Watch TV'}, {v:2}, { v: new Date(2011,1,1) }]},
{c:[{v: 'Sleep'}, {v:7, f:'7.000'}, { v: new Date(2011,1,1) }]}
]
}
You can load the datatable in the following way:
var data = new
google.visualization.DataTable(eval('('+serverJSONString+')'), 0.6)
On Wed, Dec 14, 2011 at 2:58 PM, Amir Miller <[email protected]> wrote:
> I'm creating the data on the server side using the data library and
> reading it on the client with js.
> I might not have understood the question correctly before.
> Anyhow, java creates the DataTable json object and the client draws the
> chart.
>
> Amir.
>
> --
> 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/-/V4tq7i3YjHIJ.
>
> 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.
>
--
You received this message because you are subscribed to the Google Groups
"Google Visualization API" group.
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.