Hi all!
I'm trying to use Google GeoChart library to display a map, and if I do it
on a local HTML file or somewhere like JSFiddle, it works perfectly.
However, when I embed it in a JSP on my project and deploy it (using
JBoss), calling `chart.draw` results in a JSON error:
Invalid JSON string: {":",":",":{":[",","]},":",":{":true}}
My complete Javascript method is as follows:
var data2 = google.visualization.arrayToDataTable([
[{label: 'Country', type:
'string'},
{label: 'description',
type: 'string'},
{label: 'consistency',
type: 'number'},
{type: 'string', role:
'tooltip'}],
['Canada', "CANADA", 2,
"OK"],
['France', "FRANCE", 0,
"KO"],
['USA', "USA", 1,
"Other"]
]);
var options = {
displayMode: 'region',
backgroundColor: '#81d4fa',
colorAxis: {
colors: ['red', 'orange', 'green']
},
legend: 'none',
tooltip: {
showColorCode: true
}
};
var chart = new
google.visualization.GeoChart(document.getElementById('chart_div'));
chart.draw(data2, options);
So it's clearly picking up the "structure" of the JSON object (two simple
objects, another object with an array inside, another simple object,
another object with an array inside), but for some reason is not picking up
the content, except for the 'true' value, so it looks like a problem with
quotes...
In any case, I have tried simple and double quotes, removing the quotes
from the identifiers, reducing the `options` object to a simple
var options = {
"legend": "none"
};
... but to no avail. Everything results in a `Invalid JSON string` error
(in this last case, a `Invalid JSON string: {":"}` error, since there is
only one object).
Last note: if I just use
var options = {};
it shows the map (but with the default options).
Any ideas as to why is this happening and/or how to solve it?
Thanks!
--
You received this message because you are subscribed to the Google Groups
"Google Visualization 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-visualization-api.
To view this discussion on the web visit
https://groups.google.com/d/msgid/google-visualization-api/8db49e7a-bb69-4f5a-b0a7-9db38b6188ca%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.