Search code examples
javascriptextjsextjs4

Extjs - getting 'TypeError: name is undefined' when add chart


When replacing the chart some other such grid all is well. Maybe there is sort of a mistake in the declaration chart? My chart page (projecttaskstatistics):

Ext.define('yTrack.view.project.Task.Statistics' , {
    extended: 'Ext.chart.Chart',
    alias: 'widget.projecttaskstatistics',
    width: 500,
    height: 300,
    animate: true,
    store: 'Tasks.Timehistory',
    axes: [{
        type: 'Time',
        position: 'bottom',
        fields: ['time'],
        dateFormat: 'G',
        title: 'Use of time',
        grid: true
    }, {
        type: 'Category',
        position: 'left',
        fields: ['user_name'],
        title: 'Users'
    }],
    series: [{
        type: 'bar',
        axis: 'bottom',
        highlight: true,
        tips: {
            trackMouse: true,
            width: 140,
            height: 28
            renderer: function(storeItem, item) {
                this.setTitle(storeItem.get('user_name') + ': ' + storeItem.get('time') + ' views');
            }
        },
        label: {
            display: 'insideEnd',
            field: 'time',
            renderer: Ext.util.Format.dateRenderer('G:i'),
            orientation: 'horizontal',
            color: '#333',
            'text-anchor': 'middle'
        },
        xField: 'user_name',
        yField: 'time'
    }]
});

I am can find error. Help me.


Solution

  • Errors there are, indeeed.

    There is the missing colon, as noted by Drew.

    Furthermore, your should fix this line:

    extended: 'Ext.chart.Chart',
    

    to this:

    extend: 'Ext.chart.Chart',
    

    You don't need to require a class you extend, though.