Results 1 to 2 of 2

Thread: Adding series dynamically

  1. #1

    Default Adding series dynamically

    I am creating a chart and then adding the series through for loop as number of series will be different for each time.

    HTML Code:
    RA.app.chart = new Ext.chart.Chart({
                id: 'chart'+RA.app.currentActivePanelIndex,
                store: store,
                renderTo: Ext.getBody(),
                flex: 1,
                shadow: true,
                autoShow: true,
                animate: { duration: RA.app.animateSpeed, delay: 0, easing: 'ease' },
                maxGutter: [10, 10],
                legend: {
                    position: 'right',
                },
                axes: [
                    {
                        type: 'Numeric',
                        position: 'left',
                        fields:[RA.app.groupByValueBar[0],RA.app.groupByValueBar[1],RA.app.groupByValueBar[2],RA.app.groupByValueBar[3],"others"],
                        label: {
                            renderer: Ext.util.Format.numberRenderer('0,0'),
                        },
                        title: RA.app.ys[RA.app.currentActivePanelIndex],
                        minimum: 0,
                        maximum: RA.app.Ymax[RA.app.currentActivePanelIndex]
                    },
                    {
                        type: 'Category',
                        position: 'bottom',
                        fields: RA.app.xs[RA.app.currentActivePanelIndex],
                        title: RA.app.xs[RA.app.currentActivePanelIndex]
                    }
                ],
                
            });
    I am adding the series through add method like this:
    HTML Code:
    for(i=0; i<4;i++)
                        {
                            var series = {
                                type: 'line',
                            axis: 'left',
                            //gutter: 80,
                            highlight: true,
                            xField: RA.app.xs[RA.app.currentActivePanelIndex],
                            yField: RA.app.groupByValueBar[i],
                            title:  RA.app.groupByBarLabels[i]
                        };
                        
                        RA.app.chart.add(series);
                        //RA.app.newChart[RA.app.currentActivePanelIndex].add(series);
                            }
    It is giving me error that "
    Uncaught TypeError: Object [object Object] has no method 'add"

    Please let me know how can I add series dynamically.
    Thanks

  2. #2
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,379

    Default

    This currently is not supported but we do have a feature request for this. If you want to do this, you would have to remove the chart and add in a new chart with the new series.
    Mitchell Simoens @LikelyMitch

    Check out my GitHub:
    https://github.com/mitchellsimoens

    Posts are my own, not any current, past or future employer's.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •