Thak you,
sorry but does not appear the button to format the code:
I load my json file;

function load() { 
var chart_json_data = getUrlVars()["result"]; 
if (!(typeof chart_json_data === 'undefined')){
  downloadUrl("" + chart_json_data, drawChart);
 }
 } 
function getUrlVars() 
{ var vars = {}; 
var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi,
 function(m,key,value) { 
vars[key] = value; });
 return vars; }

 function createXmlHttpRequest() {
 try { if (typeof ActiveXObject != 'undefined') {
 return new ActiveXObject('Microsoft.XMLHTTP'); } 
else if (window["XMLHttpRequest"]){ 
return new XMLHttpRequest();
 }
 } catch (e) { 
alert(e); } return null; }

 function downloadUrl(url, callback) {
 var status = -1;
 var request = createXmlHttpRequest(); 
if (!request) { 
return false;
 } 
request.onreadystatechange = function() {
 if (request.readyState == 4) {
 try { status = request.status;
 } catch (e) {
 // Usually indicates request timed out in FF.
 }
 if ((status == 200) || (status == 0)) { 
callback(request.responseText, request.status);
 request.onreadystatechange = function() {}; }
 } 
} request.open('GET', url, true);
 try {
 request.send(null);
 } catch (e) {
 alert(e);
 }
 };


// Load the Visualization API the chart package and the table chart 
package. 
google.load('visualization', '1.0', {'packages':['corechart','table']}); 
// Set a callback to run when the Google Visualization API is loaded. 
google.setOnLoadCallback(load); 
 drawChart = function(doc) { 
  if (!(typeof doc === 'undefined')) { jsonData = eval('(' + doc + ')'); }
...



and then I draw my chart and table





A little example of my json is :

{"cols":[{"id":"c1","label":"Cat","type":"string"},{"id":"c2","label":"N.","type":"number"}],
"title":"Chart",
"rows":[
{"c":[{"v":"Pubblicit\\u00E0"},{"v":11}]},
{"c":[{"v":"Trasporti"},{"v":5}]}
]
}


Rita


Il giorno mercoledì 14 novembre 2012 20:13:12 UTC+1, asgallant ha scritto:
>
> Can you post you code and a sample JSON string?
>
> On Wednesday, November 14, 2012 1:56:04 PM UTC-5, Rita wrote:
>>
>> Your solution works in Google Visualization Playgroung tool, but not in 
>> my app. I write on my own the JSON file with data for the chart, so do I 
>> have to use particular method to embed the javascript code? I tried with 
>> different escape methods with success.
>>
>> I wait any suggestion, thanks
>>
>> Rita
>>
>>
>> Il giorno mercoledì 14 novembre 2012 17:07:07 UTC+1, asgallant ha scritto:
>>>
>>> You can't use HTML in the labels.  To encode non standard characters, 
>>> you have to use the javascript UTF code, e.g. "\u00E0" for "à".  The 
>>> linebreak character in javascript is "\n", but I suspect the API strips out 
>>> extra whitespace characters, as the linebreaks are not preserved when the 
>>> chart is drawn.  So, short answer, no you cannot use linebreaks in your 
>>> title or labels in the charts.
>>>
>>> On Wednesday, November 14, 2012 6:03:21 AM UTC-5, Rita wrote:
>>>>
>>>> Hello everybody.
>>>> How can I escape html in my charts?
>>>> I have accented characters and in the DataTable I use the property 
>>>> allowHtml:true that allow me to see correctly accented character. For 
>>>> example "à" is converted in "à".
>>>> But the chart shows me "à", without converting it. I cannot find 
>>>> a property like allowHtml for the charts, can you help me? Could me 
>>>> suggest 
>>>> a way to visualize
>>>>  both in DataTable and in the chart accented characthers?
>>>> Moreover the escape for html could be useful to format properly the 
>>>> title of charts for example to insert <br>. Is it possibile?
>>>>  I have tried to use any kind of escape without success.
>>>>
>>>> Thank you
>>>> Rita
>>>>
>>>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-visualization-api/-/AuhvIdCTGPsJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-visualization-api?hl=en.

Reply via email to