Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Sencha User
    Join Date
    Aug 2011
    Posts
    39
    Vote Rating
    0
    cdiscla is on a distinguished road

      0  

    Default Unanswered: How to dynamically assign a store to a Ext.chart.Panel?

    Unanswered: How to dynamically assign a store to a Ext.chart.Panel?


    Hello
    i want to show a chart based on parameter passed from another panel; how can i bind dynamically a store instead of assigning it during the declaration of the Ext.chart.Panel, how can i do it programmatically?

    Thanks in advance and greetings
    c.

  2. #2
    Sencha User
    Join Date
    Nov 2010
    Posts
    168
    Vote Rating
    0
    philogb is on a distinguished road

      0  

    Default


    Hi - If you have a handle to the Ext.chart.Panel instance (say in a chartPanel variable), then you can access the chart and bind the store like this:


    Code:
    var chart = chartPanel.items.get(0);
    chart.bindStore(newStore);
    I hope this helps,

  3. #3
    Sencha User
    Join Date
    Aug 2011
    Posts
    39
    Vote Rating
    0
    cdiscla is on a distinguished road

      0  

    Default


    thank you very much !

  4. #4
    Sencha User
    Join Date
    Sep 2011
    Posts
    2
    Vote Rating
    0
    Breen is on a distinguished road

      0  

    Default


    Let's say this is my datastore

    Code:
    teststore = new Ext.data.Store({
        model: 'testdata',
        data : [
        {soort: 'Niezen',    waarde: 4, waarde1: 8, gem: 6},
            {soort: 'Hoesten',    waarde: 6, waarde1: 4, gem: 5},
            {soort: 'Longaandoening',   waarde: 7, waarde1: 9, gem: 8},
            {soort: 'Kreupel',    waarde: 5, waarde1: 2, gem: 3.5},
            {soort: 'Vlekken',    waarde: 5, waarde1: 9, gem: 7},
        ]
    });
    
    
    var chart = chartPanel.items.get(0);
    chart.bindStore(testdata);
    How can I use this?
    Lets say I want the values of "waarde1" ..

  5. #5
    Sencha User
    Join Date
    Apr 2011
    Posts
    8
    Vote Rating
    1
    Rafael Neri is on a distinguished road

      0  

    Default or...

    or...


    Ext.regModel('MyModel', {
    fields: [{ name: 'FieldA' },
    { name: 'FieldB' },
    { name: 'FieldC' },
    { name: 'FieldD'}]
    });

    this.store = new Ext.data.JsonStore({
    scope: this,
    model: 'MyModel',
    sorters: [
    {
    property: 'FieldA',
    direction: 'ASC'
    }
    ],
    proxy: {
    type: 'ajax',
    actionMethods: 'POST',
    url: app_relative_url + 'StoreUrl',
    reader: {
    type: 'json',
    root: 'List'
    }
    },
    listeners: {
    load: { fn: this.initializeData, scope: this },
    beforeload: { fn: this.beforeloadData, scope: this }
    }
    });

    this.graphic = new Ext.chart.Panel({
    items: [{
    xtype: 'chart',
    cls: 'barcombo1',
    theme: 'Demo',
    store: this.store,
    ...

  6. #6
    Sencha Premium Member
    Join Date
    Apr 2008
    Posts
    2
    Vote Rating
    0
    stevehn@gmail.com is on a distinguished road

      0  

    Default


    Quote Originally Posted by philogb View Post
    Hi - If you have a handle to the Ext.chart.Panel instance (say in a chartPanel variable), then you can access the chart and bind the store like this:


    Code:
    var chart = chartPanel.items.get(0);
    chart.bindStore(newStore);
    I hope this helps,
    Thank you. This is the nugget that I have been looking for all of this time. I refreshed the store and the chart but did not know that I have to rebind the store.