我想显示绿色,黄色和红色plotBands之间的值。
在所附示例中,我想显示值135,172(颜色在不断变化)
yAxis: {
min: 0,
max: 200,
minorTickInterval: 'auto',
minorTickWidth: 1,
minorTickLength: 10,
minorTickPosition: 'inside',
minorTickColor: '#666',
tickPixelInterval: 30,
tickWidth: 2,
tickPosition: 'inside',
tickLength: 10,
tickColor: '#666',
labels: {
step: 2,
rotation: 'auto'
},
title: {
text: 'km/h'
},
plotBands: [{
from: 0,
to: 135,
color: '#55BF3B' // green
}, {
from: 135,
to: 172,
color: '#DDDF0D' // yellow
}, {
from: 172,
to: 200,
color: '#DF5353' // red
}]
},
答案 0 :(得分:0)
您可以使用tickPositioner
函数来定义将在图表上显示哪些价格变动:
tickPositioner: function() {
var plotBands = this.options.plotBands,
ticks = [],
i = 0;
for (i; i <= 200; i += 20) {
ticks.push(i);
}
for (i = 0; i < plotBands.length - 1; i++) {
ticks.push(plotBands[i].to)
}
return ticks;
}
实时演示:https://jsfiddle.net/BlackLabel/1kpt7dws/
API:https://api.highcharts.com/highcharts/yAxis.tickPositioner