On Tue, Aug 11, 2009 at 12:56 PM, Hazer <[email protected]> wrote:
> > Hi, thanks for the response. > > But when you ask "has the underlying data changed", do you mean the > remote dataTable to be fetched? How could the client know if the data > has changed without sending the query at the refresh interval? Is > there some sort of implicit "hasDataChanged" request sent before > query.send is fired?? the data source is queried, and if the data source responds that the underlying data has not changed, your callback is not called. > > > thanks in advance! > > On Aug 9, 2:07 pm, MC Get Vizzy <[email protected]> wrote: > > 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 -~----------~----~----~----~------~----~------~--~---
