PDA

View Full Version : how to add series on fly for charts



guessit
27 Sep 2010, 5:56 PM
I am setting the series on fly as below

data = [
{name:'United States', code: 'US'},
{name:'Ireland', code:'IE'},
{name:'Canada', code:'CA'}
];

store = new Ext.data.JsonStore({
fields:['name', 'code']
});

store.loadData(data);

function updateCntryChartSeries(){
for(var j=0; j<store.getCount(); j++){
var v = store.getAt(j).data;
var newSeries = new Ext.chart.ColumnSeries(
{
type: 'column',
displayName: v.name,
yField: v.code,
});
chart.series.push(newSeries);
}
}

If i define the series this way its not working but if i declare the store with data, by not calling the loadData function the series is getting set.

does any one have solution for this.