Using ExtJS 4 diagrams in an ExtJS 3 application

I am trying to add an Ext4 diagram to an existing Ext3 application using ext-all-sandbox.js. I have the basics of work, but the code below gives axis.processView is not a function. It works fine without specific axes (but without any axes).

It appears that configuration objects are used directly, rather than being used to instantiate the actual axis. Any solutions to make this work?

TestGraphPanel = Ext.extend(Ext.Panel, {
    initComponent: function() {
        TestGraphPanel.superclass.initComponent.call(this);

        Ext4.define('DataPoint', {
            extend: 'Ext.data.Model',
            fields: ['xValue', 'yValue']
        });

        this.store = Ext4.create('Ext.data.Store', {
            model: 'DataPoint',
            data: [
                {xValue: 0, yValue: 2},
                {xValue: 1, yValue: 4},
                {xValue: 2, yValue: 7},
                {xValue: 3, yValue: 5},
                {xValue: 4, yValue: 8},
                {xValue: 5, yValue: 9}
            ]
        });
    },

    afterRender: function() {
        Ext4.create('Ext.chart.Chart', {
            renderTo: this.body.dom,
            width: this.ownerCt.getWidth(),
            height: this.ownerCt.getHeight(),
            store: this.store,
            axes: [
                {
                    title: 'x',
                    type: 'Numeric',
                    postition: 'bottom',
                    fields: ['xValue']
                },
                {
                    title: 'y',
                    type: 'Numeric',
                    position: 'left',
                    fields: ['yValue']
                }
            ],
            series: [
                {
                    type: 'line',
                    xField: 'xValue',
                    yField: 'yValue'
                }
            ]
        });
    }
});
+1
source share
1 answer

After a quick look at the source, I think your problem may arise because you create your chart in afterRender.

I think of these lines, in particular

//process all views (aggregated data etc) on stores
//before rendering.
me.axes.each(function(axis) {
    axis.processView();
});

. .

0

All Articles