datasource for line chart instead of datatable

57 views
Skip to first unread message

Jishnu U

unread,
Oct 27, 2012, 4:07:04 PM10/27/12
to google-visua...@googlegroups.com
Hi

Im working on a website that uses google Line charts. Im receiving data from SQL table using a library function which we made that returns data as string array. 
How can I use this array to plot in line chart.
I tried using 
 var data = google.visualization.arrayToDataTable(ar);
but as all column and row are string I cant get the plot.
Does anyone has any solution to it??

asgallant

unread,
Oct 27, 2012, 11:48:05 PM10/27/12
to google-visua...@googlegroups.com
If your string is formatted as a javascript array, you can try parsing it as JSON:

var data = google.visualization.arrayToDataTable(JSON.parse(ar));

Jishnu U

unread,
Oct 28, 2012, 7:31:21 AM10/28/12
to google-visua...@googlegroups.com

im sorry .. I dont know what a java script formatted array is. but anyways what im getting from the SQL library is normal string array (as far as I know).
one column of time stamp and one column of sensor data.
can i do something with it?

asgallant

unread,
Oct 28, 2012, 11:09:19 AM10/28/12
to google-visua...@googlegroups.com
Give what I posted a try anyway.  If it doesn't work, post an example of the value of ar and I'll take a look.
Reply all
Reply to author
Forward
0 new messages