1. #1
    Sencha User
    Join Date
    Jun 2010
    Posts
    56
    Vote Rating
    0
    dev_java is on a distinguished road

      0  

    Question Unanswered: Adding Series to line chart Dynamically

    Unanswered: Adding Series to line chart Dynamically


    Hi,

    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

    Code:
    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;
    chart.store.loadData(jsonData.myArray);
    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?

    Code:
    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?

    Thanks,
    dev_java

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,065
    Answers
    3498
    Vote Rating
    852
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Have you tried passing in actual series instances instead of config objects?
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

Thread Participants: 1