Hi,
I have successfully created a PieChart which receives its DataTable
via the Query.send method. However, it does not fire this method after
the first time.
Query query = Query.create("http://localhost:8084/
FetchDataTable");
query.setRefreshInterval(5);
query.send(new Callback(){
public void onResponse(QueryResponse response) {
if (response.isError())
SC.say("An error occured: " +
response.getDetailedMessage());
else
{
dataTable = response.getDataTable();
pie = new PieChart(dataTable,
createPieChartOptions(300, 180, "My auto refresh pie chart"));
pie.addSelectHandler
(createPieChartSelectHandler(pie));
hLayout.addMember(pie);
}
}
});
I've got 2 questions really:
1) What is causing the above code to not fire the query.send every 5
secs?
2) This onResponse creates a new pie chart and adds it to hLayout upon
every successful response. I'm assuming the correct thing would be to
call pie.draw(dataTable, createPieChartOptions(300, 180, "My auto
refresh pie chart"))
I also assume I shouldn't be creating a new PieChart in the
onResponse, so it must already have been created, but how can I create
it AND add it to my DOM before I have my first dataTable?
Here's an attempt to create the "empty" pie chart beforehand:
pie = new PieChart();
pie.addSelectHandler(createPieChartSelectHandler
(pie));
hLayout.addMember(pie);
Query query =
Query.create("http://localhost:8084/FetchDataTable");
query.setRefreshInterval(5);
query.send(new Callback(){
public void onResponse(QueryResponse response) {
if (response.isError())
SC.say("An error occured: " +
response.getDetailedMessage());
else
{
dataTable = response.getDataTable();
pie.draw(dataTable, createPieChartOptions
(300, 180, "My auto refresh pie chart"));
}
}
});
...but again, the query.send doesn't get called more than once. :(
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---