2014-03-27 18 views
0

煎茶觸摸2.3.1 CMD:4.0.XX煎茶觸摸錯誤:對象沒有方法getShowInLegend

我的煎茶觸摸圖表應用程序時,它試圖繪製圖表拋出這個錯誤:

Uncaught TypeError: Object [object Object] has no method 'getShowInLegend' AbstractChart.js?_dc=1395914109534:649
Ext.define.refreshLegendStore AbstractChart.js?_dc=1395914109534:649
Ext.define.updateSeries AbstractChart.js?_dc=1395914109534:877
setter sencha-touch-all-debug.js:5491
Base.implement.initConfig sencha-touch-all-debug.js:4920
Ext.define.constructor sencha-touch-all-debug.js:22651
Base.implement.callParent sencha-touch-all-debug.js:4656
Ext.define.constructor sencha-touch-all-debug.js:32375
Base.implement.callSuper sencha-touch-all-debug.js:4735
Ext.define.constructor Component.js?_dc=1395914109519:100
Base.implement.callSuper sencha-touch-all-debug.js:4735
Ext.define.constructor AbstractChart.js?_dc=1395914109534:626
Class sencha-touch-all-debug.js:5208
(anonymous function) VM14212:3
Ext.ClassManager.instantiate sencha-touch-all-debug.js:6936
Ext.ClassManager.instantiateByAlias sencha-touch-all-debug.js:6848
Ext.apply.factory sencha-touch-all-debug.js:9980
Ext.define.factoryItem sencha-touch-all-debug.js:32637
Ext.define.add sencha-touch-all-debug.js:32714
Ext.define.applyItems sencha-touch-all-debug.js:32538
setter sencha-touch-all-debug.js:5482
(anonymous function) sencha-touch-all-debug.js:5516
Ext.define.applyActiveItem sencha-touch-all-debug.js:33208
(anonymous function) sencha-touch-all-debug.js:16565
Base.implement.initConfig sencha-touch-all-debug.js:4920
Ext.define.constructor sencha-touch-all-debug.js:22651
Base.implement.callParent sencha-touch-all-debug.js:4656
Ext.define.constructor sencha-touch-all-debug.js:32375
Class sencha-touch-all-debug.js:5208
(anonymous function) VM14212:3
Ext.ClassManager.instantiate sencha-touch-all-debug.js:6936
Ext.ClassManager.instantiateByAlias sencha-touch-all-debug.js:6848
Ext.apply.factory sencha-touch-all-debug.js:9980
Ext.define.factoryItemWithDefaults sencha-touch-all-debug.js:32683
Ext.define.add sencha-touch-all-debug.js:32707
Ext.define.applyItems sencha-touch-all-debug.js:32538
setter sencha-touch-all-debug.js:5482
(anonymous function) sencha-touch-all-debug.js:5516
Ext.define.applyActiveItem sencha-touch-all-debug.js:33208
Base.implement.callParent sencha-touch-all-debug.js:4656
Ext.define.applyActiveItem sencha-touch-all-debug.js:46269
(anonymous function) sencha-touch-all-debug.js:16565
Base.implement.initConfig sencha-touch-all-debug.js:4920
Ext.define.constructor sencha-touch-all-debug.js:22651
Base.implement.callParent sencha-touch-all-debug.js:4656
Ext.define.constructor sencha-touch-all-debug.js:32375
Class sencha-touch-all-debug.js:5208
(anonymous function) VM14212:3
Ext.ClassManager.instantiate sencha-touch-all-debug.js:6936
Ext.ClassManager.instantiateByAlias sencha-touch-all-debug.js:6848
Ext.apply.factory sencha-touch-all-debug.js:9980
Ext.define.factoryItem sencha-touch-all-debug.js:32637
Ext.define.add sencha-touch-all-debug.js:32714
doCharts doCharts.js:394
Ext.Ajax.request.success standardFunctions.js:166
Ext.apply.callback sencha-touch-all-debug.js:10268
Ext.define.onComplete sencha-touch-all-debug.js:35765
Ext.define.onStateChange sencha-touch-all-debug.js:35709
(anonymous function)

的圖表呈現爲此視圖:

Ext.define('dashboards.view.Main', { 
    extend: 'Ext.Panel', 
    requires: [ 
     'Ext.chart.*', 
     'Ext.draw.sprite.Sector', 
     'Ext.chart.Chart', 
     'Ext.chart.series.Column', 
     'Ext.chart.AbstractChart', 
     'Ext.chart.SpaceFillingChart', 
     'Ext.dataview.component.Container', 
     'Ext.chart.series.Series', 
     'Ext.chart.series.Gauge', 
     'Ext.carousel.Indicator', 
     'Ext.carousel.Infinite', 
     'Ext.carousel.Item', 
     'Ext.carousel.Carousel', 
     'Ext.fx.easing.EaseOut', 
     'Ext.util.TranslatableGroup', 
     'Ext.chart.series.Cartesian', 
     'Ext.chart.series.Area', 
     'Ext.chart.Label', 
     'Ext.chart.Highlight', 
     'Ext.chart.Callout', 
     'Ext.chart.Transformable', 
     'Ext.chart.series.ItemEvents', 
     'Ext.chart.theme.Style', 
     'Ext.draw.Color', 
     'Ext.chart.series.Bar', 
     'Ext.chart.series.Column', 
     'Ext.chart.axis.Gauge', 
     'Ext.chart.theme.Base', 
     'Ext.chart.theme.Base', 
     'Ext.chart.theme.TitleStyle', 
     'Ext.chart.theme.GridStyle', 
     'Ext.chart.Toolbar', 
     'Ext.chart.legend.View', 
     'Ext.chart.Legend', 
     'Ext.chart.axis.Numeric', 
     'Ext.chart.axis.Category', 
     'Ext.draw.Surface', 
     'Ext.draw.Draw', 
     'Ext.draw.Matrix', 
     'Ext.draw.engine.Canvas', 
     'Ext.draw.CompositeSprite', 
     'Ext.fx.Frame', 
     'Ext.draw.Sprite', 
     'Ext.fx.Sprite', 
     'Ext.draw.sprite.Sector', 
     'Ext.draw.sprite.Rect', 
     'Ext.chart.interactions.Abstract', 
     'Ext.chart.axis.Axis', 
     'Ext.chart.axis.Abstract', 
     'Ext.util.SizeMonitor', 
     'Ext.chart.grid.HorizontalGrid','Ext.chart.grid.VerticalGrid','Ext.draw.fx.TimingFunctions','Ext.Container','Ext.TitleBar','Ext.data.Store','Ext.data.StoreManager' 
     ], 
    alias: 'widget.mainview', 
    id: 'mainpage', 
    getSlideLeftTransition: function() { 
     return { type: 'slide', direction: 'left' }; 
    }, 

    getSlideRightTransition: function() { 
     return { type: 'slide', direction: 'right' }; 
    }, 
    config: { 
     layout: { 
      type: 'fit' 
     }, 
     items: [ 
      { 
       xtype : 'container', 
       flex: 1, 
       id: 'introtext', 
       html: '<p>Please select from your dashboards above</p>' 
      }, 
      { 
       xtype : 'selectfield', 
       store : companiesStore2, 
       name : 'companies', 
       queryMode: 'local', 
       id : 'companiesSelect', 
        itemId: 'companySelect', 
        valueField : 'companyname', 
        displayField : 'companyname', 
        style: 'overflow:hidden', 
        listeners: { 
         change: function(field,value) { 
          getStats(value) 
         } 
        } 
       }, 

       { 
        xtype: 'toolbar', 
        docked: 'bottom', 
        id: 'bumtoolbar', 
        items: [] 
       }, 
       { 
       layout: { 
        pack: 'end' 
       }, 
       xtype: 'titlebar', 
       id: 'titlebartop', 
       title: 'axisfirst Dashboards', 

       docked: 'top', 
       items: [ 
        { 
         xtype: 'button', 
         text: 'Log Off', 
         itemId: 'logOffButton2', 
         id: 'logOffButton2', 
         align: 'right', 
         cls: 'logoffBtn', 
         scope: this, 
         listeners: {         
          tap: function() { 
           Ext.Msg.confirm("Log out", "Are you sure you want to logout?", function(btn) { 
           if (btn === 'yes') { 
            logout(); 
            //Ext.Viewport.setActiveItem({ xtype: loginview }); 

            } else { 
            return false; 
            } 
           }, this); 

          }       
         } 
        } 
       ] 
      }] 
    } 


}); 

該圖表使用單獨的.js文件添加。代碼如下所示:

var chartgx = { 
            cls: 'thegauge', 
            itemId: 'gauge'+tt2, 
            xtype: 'chart', 
            shadow: true, 
            store: gaugeStore, 
            width : 'auto', 
            animate: true, 
            insetPadding: 50, 
            axes: [{ 
             type: 'gauge', 
             position: 'gauge', 
             minimum: 0, 
             maximum: gaugemax, 
             steps: 10, 
             margin: 10, 
             direction: 'right' 
            }], 
            series: [{ 
             showInLegend: false, 
             type: 'gauge', 
             position: 'gauge', 
             minimum: 0, 
             maximum: gaugemax, 
             steps: 10, 
             margin: 10, 
             angleField: 'CurrentValue', 
             donut: 30, 
             colorSet:[gaugeColor,'#e1e1e1'] 

            }] 

           }; 


           var gaugeText = '<p class="gaugetitle">' + gaugeTitle + ': ' + currentValue + '</p>'; 
           var chartgx2 = Ext.Container({ 
             xtype : 'container', 
             flex: 1, 
             layout: 'fit', 
             cls: 'gaugeContainer', 
             needle: true, 
             items: chartgx, 
             html: gaugeText 
            }); 
            if (gaugeTitle !== '') { 
             allcharts.push(chartgx2); 
            } 

我曾看過AbstractChart.js,當然,它正在調用函數。我搜索了我的整個目錄(inc/app和/ src),但找不到該函數。

我已經更新了'Ext.chart.AbstractChart'需要並擴展的所有文件,但仍然出現錯誤。

有人可以告訴我哪個類的功能屬於,所以我可以從docs.sencha.com更新,或者,或者,告訴我如何糾正這個錯誤。

+0

提供您的圖表視圖的代碼。 –

+0

@SujataChanda:添加了更多的代碼 –

+0

你的圖表在哪裏? –

回答

0

關於您的問題,您的「系列」定義爲AbstractChart。你的圖表擴展了AbstractChart,所以你不需要添加它的需求(AbstractChart)。 getSeries方法由sencha-touch內核生成。擴展Ext.base的對象的所有字段都有get [MyField]並設置[MyField]。

錯誤在this函數上。當它試圖獲取ShowInLegend。但是每個系列的項目都有getShowInLegend的方法,您可以在showInLegend: true,行上確認查看here

就像我在第一行所說的,所有擴展Ext.base的對象都有get [MyField]方法,並且Ext-chart-series-Series擴展到Ext.base。

有了這些信息,這個問題可能會在構建圖表時產生一些誤解。但是我們沒有關於您的chartgx如何創建的信息。你用過Ext.create嗎?