2014-02-13 77 views
0

我想在應用程序中呈現sencha觸摸圖表,Sencha觸摸圖表在打包代碼後不工作

以下是該視圖的代碼。

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"] 
           } 
          } 
         ] 


      } 


    ], 


} 

});

建立sencha代碼後,當打包代碼運行時,我得到下面的錯誤。

遺漏的類型錯誤:無法調用未定義的app.js的方法「子」:1

我覺得我不加載一些所需的圖表類。請用這個指導我。

在此先感謝。

回答

0

包括以下課程後正常工作。

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