View Full Version : Adding Series to line chart Dynamically

29 Feb 2012, 6:15 AM

I am trying to add series to chart dynamically based on data obtained from the server. but i am getting the following error "Uncaught TypeError: Object [object Object],[object Object] has no method 'each'"
In success method of my request call, the following code is written

var chart = Ext.getCmp('my_ChartPanel');
var chart_series = [];
chart_series[0] = {
type: 'line',
xField: 'myType',
yField: 'value1',
chart_series[1] = {
type: 'line',
xField: 'myType',
yField: 'value2',
chart.series = chart_series;

I need to add the fields for the store also dynamically..I tried the following which dint work. In 'axes' also i need to pass the fields dynamically. Is it possible to do so?

chart.store.fields = ['myType', {type:'int',name:'value1'}, {type:'int',name:'value'}];

Can any one help me in resolving this issue of adding series and fields dynamically?


29 Feb 2012, 7:34 AM
Have you tried passing in actual series instances instead of config objects?