kuzaxak
kuzaxak

Reputation: 13

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.

Upvotes: 1

Views: 2905

Answers (3)

Kishore Utukuru
Kishore Utukuru

Reputation: 1

I had faced same issue and it got resolved with the below change

Remove ext-all-debug.js

<script src="ext-4.2.0.663/ext-all-debug.js"></script>

add ext-all.js

<script src="ext-4.2.0.663/ext-all.js"></script> 

it seems that it is a bug in ExtJs Debugger .js file.

Try it.hope it will get resolve.

Upvotes: 0

Andrew Lapham
Andrew Lapham

Reputation: 478

Your missing comma in your code (after height: 28 in your tips config), try this and let me know if it works:

Ext.define('yTrack.view.project.Task.Statistics' , { extend: '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' }] });

Upvotes: 0

rixo
rixo

Reputation: 25001

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.

Upvotes: 1

Related Questions