0
下面是一個條形圖,其中綠色條不會超過100,紅色條不會低於-100。如何爲HighChart圖表設置最大y軸範圍?
但是在圖的y軸上,您可以看到-150%
。我發現this fix here,但它沒有工作。 yAxis: {min: 0, max: 100}
有沒有另外一種方法來實現這個目標?
這裏是我加的條形圖
function addSentimentSeries(name, data) {
var index = findTheIndex(name);
var color = name === 'Positive sentiment' ? '#009900' : '#FF0000';
if (index) {
chart.series[index].update({
showInLegend: false,
yAxis: 2,
type: 'column',
name: name,
color: color,
data: data,
dataGrouping: { enabled: false }
}, true);
} else {
chart.addSeries({
showInLegend: false,
yAxis: 2,
type: 'column',
name: name,
color: color,
data: data,
dataGrouping: { enabled: false }
}, true);
}
chart.hideLoading();
chart.redraw();
}
這是在「修復」我從我上面找到了答案實現的,它沒有做任何事情的區域,我的條形圖仍然顯示-150%
vm.config.yAxis.push({
height: '30%',
top: '70%',
gridLineWidth: 0,
title: {
text: 'Sentiment',
style: { color: '#BFBFBF' }
},
yAxis: { min: 0, max: 100 },
offset: 0,
labels: {
formatter: function() {
return this.value + '%';
},
style: { color: '#BFBFBF' }
},
opposite: false
});
對於您找到的修復,您的意思是「它沒有工作」是什麼意思? –
@HalvorStrand只是增加了關於修復的更多細節 –
謝謝。 O型? 'min'和'max'應該直接在根中,而不是在'yAxis'屬性中。 –