Results 1 to 5 of 5

Thread: redraw pie chart dynamic with new data

  1. #1
    Sencha User
    Join Date
    Aug 2012
    Posts
    16

    Default redraw pie chart dynamic with new data

    Hello,

    i'am new in sencha , i would like to redraw a pie chart with a new list of item.
    I tryed like that :

    myChart.setStore(myList);
    myChart.redrawChart();

    But it doesn't work correctly because the list can contains more or less item than before.
    I'don't know what I should do.

    thanks

    ps: Sorry for my bad english

  2. #2
    Sencha User
    Join Date
    Aug 2012
    Posts
    16

    Default

    up

  3. #3
    Sencha Premium Member
    Join Date
    Nov 2012
    Location
    Cremona Italy
    Posts
    37

    Default

    I run in the same exact issue as you...when the number of elements changes the redraw is incomplete.
    I'm using GXT 3.0.5

    Regards

    (sorry for necroposting ;-) )

  4. #4
    Sencha Premium Member
    Join Date
    Nov 2012
    Location
    Cremona Italy
    Posts
    37

    Default

    I'm writing back to say i've found a workaround:

    Code:
    chart.redrawChart();
    Scheduler.get().scheduleDeferred(new ScheduledCommand() {
        @Override
        public void execute() {
            chart.redrawChart();
        }
    });
    Basically a dubble redraw, the second deferred.
    Hope it helps ;-)

  5. #5
    Sencha User
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,737
    Answers
    109

    Default

    Can you provide more details on this? The only way I can see this being required is if the items haven't changed yet, and you are just swapping the store. Does it work if you keep the same store, but just call replaceAll on the store to set new items?

    Have you tried this with GXT 3.1?

    Looking at the example at http://www.sencha.com/examples/#ExamplePlace:piechart, this should work as is - all that the chart does to replace its items is this:
    Code:
          regenerate.addSelectHandler(new SelectHandler() {
            @Override
            public void onSelect(SelectEvent event) {
              store.clear();
              store.addAll(TestData.getData(6, 20, 100));
              chart.redrawChart();
            }
          });
    Note however that clear/addAll could be replaced by a call to replaceAll.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •