PDA

View Full Version : how t o add series on fly for charts



guessit
27 Sep 2010, 3:33 PM
I am setting the series using the below function
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 and by not calling the loadData function the series is getting set.

does any one have solution for this.