Success! Looks like we've fixed this one. According to our records the fix was applied for EXTJS-8233 in 4.2.0.489.
  1. #1
    Sencha User
    Join Date
    Mar 2011
    Location
    Betelgeuse VII
    Posts
    86
    Vote Rating
    3
    fordprefect is on a distinguished road

      0  

    Default [Ext: 4.2.0 Beta2] - Creating a chart without a series

    [Ext: 4.2.0 Beta2] - Creating a chart without a series


    Hello,

    I'm just attempting to move to 4.2 from 4.1.1 and I'm having some issues with how I've been creating charts. I have a generic chart definition (line chart for example) that includes a chart skeleton but no series like so:

    Code:
    Ext.define('MyApp.view.chart.charts.LineChart', {
        extend: 'Ext.container.Container',
        alias: 'widget.linechart',
    
    
        uses: [
            'Ext.data.JsonStore',
            'Ext.chart.*',
            'Ext.fx.target.Sprite',
            'Ext.layout.container.Fit'
        ],
    
    
        border: false,
    
    
        initComponent: function () {
            Ext.apply(this, {
                layout: 'fit',
                items: {
                    xtype: 'chart',
                    animate: false,
                    store: 'ChartStore',
                    border: false,
                    insetPadding: 20,
                    height: 375,
                    legend: {
                        position: 'bottom'
                    },
                    axes: [{
                        type: 'Numeric',
                        position: 'left',
                        fields: [],
                        minorTickSteps: 1
                    }, {
                        type: 'Category',
                        position: 'bottom',
                        fields: ['DisplayText'],
                        label: {
                            rotate: {
                                degrees: 270
                            }
                        }
                    }]
                }
            });
            this.callParent(arguments);
        }
    });
    I would then create the chart:

    Code:
    var myChart = Ext.create('MyApp.view.chart.charts.LineChart');
    However at this point I'm getting an error thrown:

    Code:
    TypeError: series[0] is undefined
    I'm assuming it's no longer possible to create a chart without a series? Previously I would do the above and then iterate through the store adding any records in the store for a series, this way I wouldn't have to declare what items would be in the series since it would vary:

    Code:
    Ext.iterate(record, function (key, value) {
     chart.series.add({ type: 'line', axis: 'left', smooth: true, xField: 'DisplayText', yField: key, title: key});
    });
    Thanks

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,015
    Vote Rating
    847
    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


    Sounds like a bug was introduced. Normally you should specify the series but not all use cases want this to be.

    I have opened a bug in our bug tracker.

  3. #3
    Sencha User
    Join Date
    Mar 2011
    Location
    Betelgeuse VII
    Posts
    86
    Vote Rating
    3
    fordprefect is on a distinguished road

      0  

    Default


    Thanks Mitchell.

Thread Participants: 1

Tags for this Thread