2012-04-20 46 views
1

我試圖在面板內繪製圖表。圖表欄正在繪製正確,但繪製圖表時不顯示x和y軸標籤。代碼繪製結構圖如下所示:軸標籤在ExtJS中的圖表中不可見4

Ext.require([ 
    'Ext.form.*', 
    'Ext.chart.*', 
    'Ext.layout.container.*' 
]); 

Ext.define('ilp.view.EmployeeCountControl', { 
    extend : 'Ext.panel.Panel', 
    alias : 'widget.employeeCountControl', 

    require : [ 
     'ilp.store.Employees', 
     'ilp.store.Dimensions' 
    ], 

    layout : { 
     type : 'vbox', 
     align : 'stretch', 
     pack : 'start' 
    }, 

    title : 'Select dimension to view chart', 

    initComponent : function() { 
     this.items = [ 
      { 
       xtype : 'combobox', 
       fieldLabel : 'Select Dimension', 
       store : 'Dimensions', 
       queryMode : 'local', 
       displayField : 'name', 
       valueField : 'dimension', 
       flex : 1 
      }, 
      { 
       xtype : 'chart', 
       title : 'selected dimension', 
       store : 'Employees', 
       flex : 2, 
       width: 150, 
       height: 200, 
       legend : { 
        position : 'right' 
       }, 
       axes : [ 
        { 
         title : 'Emp Count', 
         type : 'Numeric', 
         position : 'left', 
         fields : ['hpCount', 'nonhpCount'], 
         minimum : 0, 
         grid : true 
        }, 
        { 
         title : 'selected dimension', 
         type : 'Category', 
         position : 'bottom', 
         fields : ['dimension'] 
        } 
       ], 
       series : [ 
        { 
         type : 'bar', 
         column :true, 
         stacked : true, 
         highlight: true, 
         axis : 'left', 
         xField : ['dimension'], 
         yField : ['hpCount', 'nonhpCount'], 
         yPadding : 10 
        } 
       ] 
      } 
     ]; 
     this.callParent(arguments); 
    } 
}); 

,什麼被繪製如下:

enter image description here

正如你所看到的,不被顯示在圖表標題和軸值。

任何人都可以告訴我爲什麼會這樣?

在此先感謝!


編輯1

移動legend至底部後,我得到x軸的值,但現在這些價值觀越來越背後隱藏的傳說,以及那些值外出面板。有誰知道如何減小實際圖表和小節的大小以適合軸值?我的圖表現在看起來如下:

enter image description here

回答

3

寬度和/或填充你的佈局和/或面板和看到的變化。我認爲這是關於圖表父容器而不是圖表本身。

+0

感謝您的回覆。我一定會嘗試設置寬度/填充屬性。圖表父容器會有什麼問題?我試圖設置「佈局」以適應,錨定,vbox,但輸出保持不變。我發現ExtJS 4.0.3有一些bug,所以我下載了新版本4.1RC3,但問題依然存在。 – Shekhar 2012-04-23 06:00:20

+0

這個例子呢? http://docs.sencha.com/ext-js/4-0/#!/example/charts/Column2.html你有這個問題嗎? – Natasha 2012-04-23 07:42:41

+0

我的問題現在解決了。一旦顯示面板,我必須將商店的'autoLoad'屬性更改爲'true'以加載圖表數據。我現在不使用堆疊圖表。看來ExtJS堆疊條形圖存在一些問題。 – Shekhar 2012-04-23 08:50:05