Hello,
I've implemented a custom data source using the powerful Grails
framework; here how I use this source in the HTML page:
...
google.setOnLoadCallback(initialize);
function initialize() {
var query = new google.visualization.Query('
http://localhost:8080/
grailsbox/visualization/data?responseHandler=myHandler');
query.send(null);
}
function myHandler(response) {
// Tester response.status
var dt = new google.visualization.DataTable(response.table,
response.version);
var chart = new google.visualization.PieChart
(document.getElementById('chart_div'));
chart.draw(dt, {width: 400, height: 240, is3D: true});
}
...
The URL is used to fetch JSON data (using a Grails controller action):
{"version":"0.5","reqId":"1","status":"ok","table":{"cols":[...
All is OK: the graph is displayed! But I remark that a JavaScript
error is generated after 30 seconds. I understood that it's because I
use null in the query.send: the API tries to call an handler.
If I use an handler: query.send(myHandler1); with myHandler1 defined
like this
function myHandler1(response) {
if (response.isError()) {
alert('Error in query: ' + response.getMessage() + ' ' +
response.getDetailedMessage());
return;
}
}
I see an error message telling "Request timed out".
What I missed? The documentation seems to say to use the Query's get
method, but it is not defined.
Thank you for any help!
Cheers,
Bertrand
http://www.odelia-technologies.com/