簡體   English   中英

extjs-添加圖表時出現'TypeError:name undefined'

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

替換圖表時,其他類似的網格都很好。 聲明表中可能存在某種錯誤? 我的圖表頁面(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'
    }]
});

我可以找到錯誤。 幫我。

確實存在錯誤。

正如Drew所指出的那樣,這里缺少冒號。

此外,您應該修復此行:

extended: 'Ext.chart.Chart',

對此:

extend: 'Ext.chart.Chart',

不過,您不需要擴展類。

您的代碼中缺少逗號(高度:提示配置中為28),請嘗試此操作,並讓我知道它是否有效:

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' }] });

我遇到了同樣的問題,以下更改解決了該問題

刪除ext-all-debug.js

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

添加ext-all.js

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

看來這是ExtJs Debugger .js文件中的錯誤。

試試看。希望它能解決。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM