2014-02-25 36 views
1

我的條形圖出現問題。我正在顯示應該表現得像百分比條形圖的條形圖。這一切都正常工作,除了事實,當我的百分比值在55%,X軸到60%。它動態調整大小,但是,我希望它永遠留在100Extjs堆疊條形圖數字軸應該是懶惰

繼承人我的代碼

var store = Ext.create('Ext.data.Store', { 
    fields: ['process', 'identifikation', 'beurteilung', 'training', 'zusage', 'gewonnen'], 
    data: [ 
     { process: 'Prozess', identifikation: 10, beurteilung: 20, training: 20, zusage: 0, gewonnen: 0 } 
    ] 
}); 

var chart = Ext.create('Ext.chart.Chart', { 
    width: 500, 
    height: 200, 
    theme: 'Browser:gradients', 
    animate: true, 
    shadow: true, 
    store: store, 
    legend: { 
     position: 'top' 
    }, 
    axes: [{ 
     type: 'Numeric', 
     position: 'bottom', 
     fields: ['identifikation', 'beurteilung', 'training', 'zusage', 'gewonnen'], 
     title: true, 
    }, { 
     type: 'Category', 
     position: 'left', 
     fields: ['process'], 
     title: true 
    }], 
    series: [{ 
     type: 'bar', 
     axis: 'bottom', 
     gutter: 80, 
     xField: 'process', 
     yField: ['identifikation', 'beurteilung', 'training', 'zusage', 'gewonnen'], 
     stacked: true 
    }] 
}); 

我希望有人能告訴我一個方法,如何設置x軸的尺寸

親切的問候

回答

0

您可以將最小值和最大值設置爲您的數值軸,這將強制軸達到這些值。

var chart = Ext.create('Ext.chart.Chart', { 
width: 500, 
height: 200, 
theme: 'Browser:gradients', 
animate: true, 
shadow: true, 
store: store, 
legend: { 
    position: 'top' 
}, 
axes: [{ 
    type: 'Numeric', 
    minimum: 0, 
    maximum: 100, //You need to change this values dynamically if you percentages are more than 100, as with this field it restricts to 100 
    position: 'bottom', 
    fields: ['identifikation', 'beurteilung', 'training', 'zusage', 'gewonnen'], 
    title: true, 
}, { 
    type: 'Category', 
    position: 'left', 
    fields: ['process'], 
    title: true 
}], 
series: [{ 
    type: 'bar', 
    axis: 'bottom', 
    gutter: 80, 
    xField: 'process', 
    yField: ['identifikation', 'beurteilung', 'training', 'zusage', 'gewonnen'], 
    stacked: true 
}] 
}); 
+0

我該如何更改動態最大值? – BhandariS