Hello, Since your chart is displaying the data properly in the initial state and after changing the store, if it is not updating the data in the chart, try using the chart.update() method after you commit changes in the store.. tell me if it works.. or else we can think of other things..this is the initial solution i can suggest.
thanks and regards, Phani On Sun, Mar 7, 2010 at 6:20 AM, new_newbie <[email protected]> wrote: > Hi, > > I am working on a vote widget which shows the vote by barchart. I have > problem on refreshing, showing the new statistics, after the user > click the yes button or no button. > The constructor is doing it right. It is able to put up the initialize > statistics. > The problem is on redraw after the user click the vote button. > > The following is the extract of my code > > public class VoteChart extends BarChart{ > private VoteAccessAsync voteAccessProxy; > > private Object[][] data = new Object[][]{ > new Object[]{new String("Vote"), new Integer(0), new > Integer(0)} <------Initial vote stat > }; > > private int oid; > MemoryProxy proxy; > RecordDef recordDef; > ArrayReader reader; > private Store store; > VoteChart(int _oid) //Constructor is doing the right job > { > oid=_oid; > > voteAccessProxy=(VoteAccessAsync)GWT.create(VoteAccess.class); > ServiceDefTarget endpoint = (ServiceDefTarget) > voteAccessProxy ; > endpoint.setServiceEntryPoint(GWT.getModuleBaseURL() + "/ > VoteAccess"); > //this.setTitle, setXField, setYField.....The X-Y axis are displayed > correctly > recordDef = new RecordDef( > new FieldDef[]{ > new StringFieldDef("Vote"), > new IntegerFieldDef("Yes"), > new IntegerFieldDef("No"), > } > ); > > proxy = new MemoryProxy(data); > reader = new ArrayReader(recordDef); > store = new Store(proxy, reader); > store.load(); > this.setStore(store); > } > > //This following part is the one needs to be fixed. The result returns > the correct info from database. The data is updated. The MemoryProxy > is re-constructed. Have tried various way including > store.commitchanges() but still doesnt re-draw the chart. Pleease > help. > > public void loadData() > { > //AsyncCallback<Vote> > AsyncCallback<Vote> callback= > new AsyncCallback<Vote>(){ > public void onSuccess(Vote result) { > data = new Object[][]{ > new Object[]{ > new > String(result.getQuestion()), > new > Integer(result.getYes()), > new > Integer(result.getNo())} > }; > System.out.println("Data is > loaded: " + > > result.getQuestion() + " " + > > result.getYes()+ " " + > > result.getNo() > ); > System.out.println("Store > load and commit changes"); > //store.load(); > //store.commitChanges(); > > proxy = new MemoryProxy(data); > reader = new ArrayReader(recordDef); > store = new Store(proxy, reader); > store.load(); > VoteChart.this.setStore(store); > VoteChart.this.refresh(); > } > }; > voteAccessProxy.getVote(oid, callback); > > } > > Thanks a lot > > -- > You received this message because you are subscribed to the Google Groups > "GWT-Ext Developer Forum" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<gwt-ext%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/gwt-ext?hl=en. > > -- Regards, Phani Kumar, Associate Software Engineer - R & D, Sid Global Solutions, Bangalore. Ph: +91 9916435979 -- You received this message because you are subscribed to the Google Groups "GWT-Ext Developer Forum" 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/gwt-ext?hl=en.
