Greetings,
I want to create a dashboard of multiple tables, charts, pies, etc.
that all call for there data independently via json.
I got my first visualization table working perfectly via the query.send
() call, however when I add a second call, only the first one is drawn
and the other table appear to time out.
What am I doing wrong?
Here is my code:
<script type="text/javascript">
google.load("visualization", "1", { packages: ["table"] });
google.setOnLoadCallback(initialize);
function initialize() {
// The URL here is the URL of the JSON data.
var stats_query = new google.visualization.Query('http://
jalbrecht.loopnet.com:81/json_data.aspx?d=Stats')
stats_query.send(drawStatsChart);
var sales_query = new google.visualization.Query('http://
jalbrecht.loopnet.com:81/json_data.aspx?d=Sales')
sales_query.send(drawSalesChart);
}
function drawStatsChart(response) {
if (isResponseOK(response, document.getElementById
('StatsTable_div'))) {
//No error go for it.
var data = response.getDataTable();
var table = new google.visualization.Table
(document.getElementById('StatsTable_div'));
var formatter = new
google.visualization.TableArrowFormat();
formatter.format(data, 3); // Apply formatter to
column
table.draw(data, { allowHtml: true, showRowNumber:
false });
}
}
function drawSalesChart(response) {
if (isResponseOK(response, document.getElementById
('SalesTable_div'))) {
//No error go for it.
var data = response.getDataTable();
var table = new google.visualization.Table
(document.getElementById('SalesTable_div'));
table.draw(data, { allowHtml: true, showRowNumber:
false });
}
}
function isResponseOK(response, el) {
//Check response object for error info.
if (response.isError()) {
//alert('uh oh!');
//Display error info in target element.
el.innerHTML = response.getDetailedMessage();
return false;
} else {
return true;
}
}
</script>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Visualization API" group.
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
-~----------~----~----~----~------~----~------~--~---