Results 1 to 3 of 3

Thread: ExtJS Chart in MVC

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Sencha User
    Join Date
    Jul 2011
    Posts
    2

    Default Answered: ExtJS Chart in MVC

    Ext version tested:
    • Ext 4.2
    Browser versions tested against:
    • Chrome 26 (Windows)
    Description:
    • Ext.chart.Chart - in MVC doesnt affect
    Steps to reproduce the problem:
    • Create a MVC model for ExtJS Chart
    The result that was expected:
    • The tab should be appeared
    The result that occurs instead:
    • Uncaught TypeError: Cannot read property 'data' of null.
    Test Case:

    Model
    Code:
    Ext.define('HH.model.SalesChart', {
        extend: 'Ext.data.Model',
        fields: ['temperature', {name: 'date',type: 'date',dateFormat: 'd-m-Y'}]
    });
    

    Store
    Code:
    Ext.define('HH.store.SalesChart', {
        extend: 'Ext.data.Store',
        model: 'HH.model.SalesChart',
        data: [
            {temperature: 58, date: '13-10-2013'},
            {temperature: 63, date: '14-10-2013'},
            {temperature: 73, date: '15-10-2013'},
            {temperature: 78, date: '16-10-2013'},
            {temperature: 81, date: '17-10-2013'}
        ]
    });

    View
    Code:
    Ext.define('HH.view.chart.SalesChart', {
        extend: 'Ext.chart.Chart',
        alias: 'widget.saleschart',
        store: 'SalesChart',
        axes: [
            {
                title: 'Temperature',
                type: 'Numeric',
                position: 'left',
                fields: ['temperature'],
                minimum: 0,
                maximum: 100
            },
            {
                title: 'Time',
                type: 'Time',
                position: 'bottom',
                fields: ['date'],
                dateFormat: 'd M'
            }
        ],
        series: [
            {
                type: 'line',
                xField: 'date',
                yField: 'temperature'
            }
        ],
        initComponent: function() {
    
    
            this.callParent(arguments);
        }
    });

    Controller
    Code:
    Ext.define('HH.controller.Charts', {
        extend: 'Ext.app.Controller',
        views: ['center.Dashboard'],
        store:['SalesChart'],
        model:['SalesChart'],
        refs: [
            {
                ref: 'dashboardPanel',
                selector: 'dashboard-panel'
            }
        ],
        init: function() {
            console.log('charts controller init()');
        }
    });


  2. What if you did 'stores' instead of 'store' and 'models' instead of 'model' in your controller?

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
  •