Hi all,
I'm new to the chart API and I'm having a problem getting the chart to
recognize the JSON I'm passing to it. Here is the JSON data (this is being
returned from an Ajax call):
[[ "Provider Codes", "Annotation Score", { role: "annotation" }, "Score",
"DB 50th Percentile", "75th Percentile", "50th Percentile", "25th
Percentile"],["0003", 3.1, "4.75", 1.65000000000, 4.31, 4.52, 4.40,
4.24],["0009", 3.1, "4.73", 1.63000000000, 4.31, 4.52, 4.40, 4.24],["0002",
3.1, "4.57", 1.47000000000, 4.31, 4.52, 4.40, 4.24],["0004", 3.1, "4.50",
1.40000000000, 4.31, 4.52, 4.40, 4.24],["0001", 3.1, "4.44", 1.34000000000,
4.31, 4.52, 4.40, 4.24],["0011", 3.1, "4.43", 1.33000000000, 4.31, 4.52,
4.40, 4.24],["0005", 3.1, "4.37", 1.27000000000, 4.31, 4.52, 4.40,
4.24],["0014", 3.1, "4.34", 1.24000000000, 4.31, 4.52, 4.40, 4.24],["0010",
3.1, "4.25", 1.15000000000, 4.31, 4.52, 4.40, 4.24],["0012", 3.1, "4.20",
1.10000000000, 4.31, 4.52, 4.40, 4.24],["0007", 3.1, "4.18", 1.08000000000,
4.31, 4.52, 4.40, 4.24],["0013", 3.1, "3.50", 0.40000000000, 4.31, 4.52,
4.40, 4.24]]
Originally I was just passing it to the chart like this:
var data = google.visualization.arrayToDataTable(jsonData);
but I kept getting a "Not an array" error. Based on another post I changed
my code to pass it through jQuery's $.parseJSON function:
var data = google.visualization.arrayToDataTable($.parseJSON(jsonData));
But that gives me an "Invalid character" error. The problem seems to be the
3rd column that says: { role: "annotation" }. Apparently the parseJSON
method doesn't like the curly braces. But the chart API won't work if I put
double-quotes around that text. Does anybody know how to solve this?
Thanks!
Phil
--
You received this message because you are subscribed to the Google Groups
"Google Chart API" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-chart-api.
For more options, visit https://groups.google.com/d/optout.