虽然没有自动化的方法,但您可以使用plotBands来实现外观。
var categories = ['one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine'];
var plotBands = [];
for (var i = 0; i < categories.length; i++) {
if (i % 3 == 1) {
plotBands.push({
color: '#fecdfe',
from: i - .5,
to: i + .5
});
} else if (i % 3 == 2) {
plotBands.push({
color: '#cdfee5',
from: i - .5,
to: i + .5
});
}
}
Highcharts.chart('container', {
yAxis: {
},
xAxis: {
categories: categories,
plotBands: plotBands,
},
series: [{
type: 'bar',
data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4],
}]
});
http://jsfiddle.net/wskt4hzz/