1. #1
    Ext User
    Join Date
    Jun 2009
    Posts
    23
    Vote Rating
    0
    Copernicus is on a distinguished road

      0  

    Default Chart Series refresh - best way?

    Chart Series refresh - best way?


    Hi all,

    I have a interesting problem for you to crack.

    It seems simple. I want to update the chart series displayName on every store reload of data:

    Code:
    chart : {
    ...
    
    series : [{
    ...
    displayName : 'logname',
    ...
    }]
    
    ...
    }
    This is how I understand it after experimenting (could be wrong):

    1) The chart series is set as part of the chart object creation (the config object)
    2) The chart series only updates when the chart render method runs.
    3) The render method only runs when creating the chart object from scratch - not on store updates.

    So right now Im recreating the chart object for every load from the store just to get the series information to update. It works, but its expensive and not elegant.

    I would really appreciate a more elegant solution. Like loading the displayName from the store data records and trigger a render afterwards, but Im not sure how to do that, if it works, or if its a good solution.

    Thank you in advance! Hopefully I have explained the problem so it makes sense to you.

  2. #2
    Ext User
    Join Date
    Jun 2009
    Posts
    23
    Vote Rating
    0
    Copernicus is on a distinguished road

      0  

    Default


    I found a solution. Just fire the 'render' event once the store has loaded.

    Code:
    chart.fireEvent('render', chart)
    Then in the chart I have a event listener hooked to the render event that does the update of the displayName:

    Code:
                myChart.on({
                            'render' : function(comp) {
                                var randomnumber=Math.floor(Math.random()*11)
                                comp.series[0].displayName = randomnumber;                           
                            }});
    Random number is just to check that it works with a changing value.

    Still, this may not be the best solution so if anyone has a even better solution, im all ears.

  3. #3
    Ext User
    Join Date
    Jun 2009
    Posts
    23
    Vote Rating
    0
    Copernicus is on a distinguished road

      0  

    Default


    Ehum...

    Sorry for wasting forum space with this thread. It turns out it was me who wasnt thinking...

    Its possible to update the chart series whenever you want. My code had a logical error that had to do with delayed loading of the store to not react to grid selectionchange events immediately.

    Thank you anyways...

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar