1. #1
    Sencha User
    Join Date
    Aug 2012
    Posts
    3
    Vote Rating
    0
    bob_and_ted is on a distinguished road

      0  

    Default Answered: Reload chart datastore

    Answered: Reload chart datastore


    Using Beta 2.1 with charts.

    I'm using a simple data store that generates random data. I would like to refresh my line chart with this data, but so far had no success in this. I have tried:

    Ext.getStore('mystore').load();

    But nothing happens on my chart at all. However, this is working:

    Ext.getStore('mystore').removeAll();

    Great, so I can remove all the data from the chart. But how can I load it again and refresh the chart?

    Thanks,

  2. Try adding something like this inside your store definition:

    refresh : function()
    {
    // Generate a fresh set of random values for display on the chart
    var newData = generateData(5,1);

    // Update this store's data field, which will cause a chart refresh
    this.setData(newData);
    }

    Then hook up a UI button to call this refresh method:

    var store = Ext.getStore('myStore');
    store.refresh();

  3. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,327
    Answers
    3540
    Vote Rating
    850
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Did you make sure the request is actually being made? Don't see why it shouldn't though. Also, is the data different?
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  4. #3
    Sencha Premium Member
    Join Date
    Mar 2012
    Posts
    83
    Answers
    2
    Vote Rating
    1
    scottd is on a distinguished road

      0  

    Default


    Try adding something like this inside your store definition:

    refresh : function()
    {
    // Generate a fresh set of random values for display on the chart
    var newData = generateData(5,1);

    // Update this store's data field, which will cause a chart refresh
    this.setData(newData);
    }

    Then hook up a UI button to call this refresh method:

    var store = Ext.getStore('myStore');
    store.refresh();

  5. #4
    Sencha User
    Join Date
    Feb 2013
    Posts
    13
    Vote Rating
    0
    samuelatef is on a distinguished road

      0  

    Default


    i have the same issue on stockapp example, i want to add values to the chart on runtime
    i successfully add to the store but the chart never display the new added values
    i use this line to add to the store
    Ext.getStore('Apple').add({date:datevar,open: 583.4, high:590, low:583.1, close:587.41,volume: 12896200,adjClose: 587.41});
    and i check the record is added by this
    console.log("count"+Ext.getStore('Apple').getCount( ));
    and it is added successfully
    and when i call Ext.getStore('Apple').refresh(); it throws
    Uncaught TypeError: Object [object Object] has no method 'refresh'