Thank you, Daniel. The HTML seemed to be generated successfully, and the options object arrived at the chart.draw method with all the values.
Anyway, I created a new JSP, added everything as it was and it worked... so I started working on that new one. Guess I'll never know what happened, but hey, it's working now :) Thanks! Gonzalo. On Wednesday, 30 September 2015 14:12:15 UTC+2, Daniel LaLiberte wrote: > > Gonzalo, > > It would be useful to look at the html that is generated from the JSP. Do > "view source" in your browser. Perhaps by looking at that you will be able > to figure out how you need to change your JSP. > > On Wed, Sep 30, 2015 at 3:14 AM, Gonzalo Rodríguez Píriz < > [email protected] <javascript:>> wrote: > >> 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] >> <javascript:>. >> To post to this group, send email to [email protected] >> <javascript:>. >> 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 >> >> <https://groups.google.com/d/msgid/google-visualization-api/8db49e7a-bb69-4f5a-b0a7-9db38b6188ca%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> > > > > -- > Daniel LaLiberte <https://plus.google.com/100631381223468223275?prsrc=2> > - 978-394-1058 > [email protected] <javascript:> 5CC, Cambridge MA > [email protected] <javascript:> 9 Juniper Ridge Road, Acton MA > -- 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/6001e4cd-3f55-4080-b884-5015c652ae17%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
