Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Ajax, JSON and googlecharts..oh MY!
Message
From
09/07/2014 14:07:17
 
 
General information
Forum:
Javascript
Category:
JQuery
Miscellaneous
Thread ID:
01603355
Message ID:
01603427
Views:
34
>
>Hmm. The AjaxData string looks odd. 'd' should be an array of arrays so would look like this (note the extra square brackets):
"{\"d\":[ [\"Time\",\"DB1\",\"DB2\",\"DB3\",\"DB4\"],[\"1:00\",54,50,57,47],[\"2:00\",56,46,63,20]]}"
var MyArray = Json.parse(AjaxData) on that would give you an object 'd' with three 'rows' - the first containing the column information and the other two holding data. So if you wanted to pass the whole thing to google visualization it would be:
google.Visualization.arrayToDataTable(MyArray.d,false);
(false indicates first row is header data). If you just wanted the first data row passed in then
google.Visualization.arrayToDataTable(MyArray.d[1]);

Got the AjaxData to come back with the double brackets
MyArray is defined as type Object
MyArray.d is defined as a string

so, <pre>google.Visualization.arrayToDataTable(MyArray.d,false);
returns - you guessed it - "Not an array" (headdesk)
"You don't manage people. You manage things - people you lead" Adm. Grace Hopper
Pflugerville, between a Rock and a Weird Place
Previous
Reply
Map
View

Click here to load this message in the networking platform