簡體   English   中英

ExtJS量規圖表系列-setValue()不是函數

[英]ExtJS gauge chart series - setValue() is not a function

我有一段代碼看起來像這樣:

var myChart = this.items[i].items[j].down().down();
myChart.series.items[0].setValue(30);

myChart定義明確。 當我在螢火蟲中監視它時,它包含圖表。

我知道儀表不是圖表的類型而是系列的類型,所以我真的不明白為什么會出現錯誤“ setValue is a function”!

如果有人可以提供幫助,那將真的很酷,因為我對此感到非常惱火。

這是我的視圖定義:

Ext.define('MyApp.view.portlet.GaugePortlet', {
    extend: 'Ext.panel.Panel',
    alias: 'widget.gaugeportlet',
    height: 300,
    requires: [
        'Ext.data.JsonStore',
        'Ext.chart.theme.Base',
        'Ext.chart.series.Series',
        'Ext.chart.series.Line',
        'Ext.chart.axis.Numeric',
        'Ext.chart.*',
        'Ext.chart.axis.Gauge',
        'Ext.chart.series.*'],

    initComponent: function () {

        Ext.apply(this, {
            layout: 'fit',
            items: {
                xtype: 'chart',
                animate: {
                    easing: 'elasticIn',
                    duration: 1000
                },
                legend: {
                    position: 'bottom'
                },
                axes: [{
                    type: 'gauge',
                    position: 'gauge',
                    minimum: 0,
                    maximum: 2,
                    steps: 10
                }],
                series: [{
                    type: 'gauge',
                    donut: false,
                    colorSet: ['#F49D10', '#ddd']
                }]
            }
        });

        this.callParent(arguments);
    }
});

我現在不想使用動態存儲,我只想測試設置硬編碼的值。

謝謝

我終於通過在視圖的afterLayout事件中使用setValue修復了此錯誤。

所以我的代碼現在看起來像這樣:

//view declaration...
listeners:
{
    afterlayout: function ()
    {
        //use setValue here.
    }
}

最終,我面臨着另一個問題……螢火蟲中沒有更多錯誤,但是從視覺上看,我的儀表圖沒有顯示任何值。 它呈現的很好,但是它是空的。...我嘗試使用doLayout()或doComponentLayout()方法對其進行更新,但是仍然沒有任何反應。

暫無
暫無

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

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