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