regarding the refresh interval, is it possible that the underlying data has not changed? if the data has not changed, your callback will not be called. regarding the redraw, what you have should work -- let me know if you have further questions.
On Tue, Aug 4, 2009 at 10:56 AM, Hazer <[email protected]> wrote: > > 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 -~----------~----~----~----~------~----~------~--~---
