View Full Version : Chart Series refresh - best way?

15 Aug 2009, 1:20 AM
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:

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.

15 Aug 2009, 2:06 AM
I found a solution. Just fire the 'render' event once the store has loaded.

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:

'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. :)

15 Aug 2009, 2:36 AM

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...