简体   繁体   English

打包代码后,Sencha触摸图无法正常工作

[英]Sencha touch chart not working after packaging the code

I am trying to render sencha touch charts in an app, 我正在尝试在应用程序中渲染sencha触摸图,

following is the code of that view. 以下是该视图的代码。

Ext.define('xxxx.view.dashboard.EventAnalyticsChart', {
extend : 'Ext.Panel',
xtype : 'analyticsChartPanel',
requires:['Ext.chart.grid.HorizontalGrid',
          'Ext.chart.grid.VerticalGrid'],
initialize : function() {

},
config : {

    layout:{
        type:'card'
    },
    items : [
             {
                // Toolbar to be displayed on the File Rack Screen
                xtype : 'toolbar',
                ui : 'light',
                docked : 'top',
                title : "Dashboard",

             }, 

             {
                xtype:'panel',
                docked : 'top',
                height:60,
                layout:{
                    type:'vbox',
                    align:'center',
                    pack:'center'
                },
                items:[



             {
                 xtype : 'chart',
                 background: 'white',
                 flipXY: true,
                 legend: {
                     position: "bottom"
                 },
                 store: {
                        fields: ['name', 'g1', 'g2', 'g3'],
                        data: [
                            {"name": "Work", "g1": 2.67, "g2": 14.87, "g3": 0.41},
                            {"name": "Office", "g1": 1.90, "g2": 5.72, "g3": 14.80},
                            {"name": "Google", "g1": 18.34, "g2": 0.04, "g3": 22.35},
                            {"name": "Facebook", "g1": 21.37, "g2": 2.13, "g3": 12.98},

                        ]
                    },

                    interactions: ['panzoom'],

                    //set legend configuration
                    legend: {
                        position: 'right',
                        width: 80
                    },

                    //define the x and y-axis configuration.
                    axes: [
                        {
                            type: 'numeric',
                            position: 'bottom',
                            grid: true,
                            minimum: 0
                        },
                        {
                            type: 'category',
                            position: 'left'
                        }
                    ],

                    series: [
                             {
                                 type: 'bar',
                                 xField: 'name',
                                 yField: ['g1', 'g2', 'g3'],
                                 axis: 'bottom',
                                 highlight: true,
                                 showInLegend: true,
                                 style: {
                                     stroke: 'rgb(40,40,40)',
                                     maxBarWidth: 30
                                 },
                                 // Cycles the red, green, and blue fill mode over the 2008, 2009,.., 2011, 2012 items
                                 // subStyle parameters also override style parameters
                                 subStyle: {
                                     fill: ["#115fa6", "#94ae0a", "#a61120", "#ff8809", "#ffd13e", "#a61187", "#24ad9a", "#7c7474", "#a66111"]
                                 }
                             }
                         ]


             }


    ],


}

}); });

After building the sencha code, when the packaged code is run i get the below error. 构建sencha代码后,运行打包的代码时出现以下错误。

Uncaught TypeError: Cannot call method 'substring' of undefined app.js:1 未捕获的TypeError:无法调用未定义app.js的方法“ substring”:1

i think i am not loading some of the classes needed for the charts. 我认为我没有加载图表所需的一些课程。 Please do guide me with this. 请以此为指导。

thanks in advance. 提前致谢。

Working fine after including following classes. 包括以下课程,可以正常工作。

          'Ext.chart.axis.Numeric',
          'Ext.chart.axis.Category',
          'Ext.chart.series.Line',
          'Ext.chart.interactions.PanZoom',
          'Ext.chart.series.Bar'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM