当您渲染图表时,请使用:
/*********************************************************
* Generate the example chart
*********************************************************/
var chart = new Highcharts.Chart({
chart: {
renderTo: 'container'
},
title: {
text: 'Chart 1'
},
xAxis: {
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
},
series: [{
type: 'arearange',
data: testData,
fillColor: {
pattern: 'http://i.stack.imgur.com/dezhE.png',
width: 10,
height: 300 + Math.round(testData[0][0] / 100) * 100
}
}]
});
var chart2 = new Highcharts.Chart({
chart: {
renderTo: 'container2'
},
title: {
text: 'Chart 2'
},
xAxis: {
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
},
series: [{
type: 'arearange',
data: testData2,
fillColor: {
pattern: 'http://i.stack.imgur.com/dezhE.png',
width: 10,
height: 300 + Math.round(testData2[0][0] / 100) * 100
}
}]
});
它将 Y 轴的起点 (Math.round(testData[0][0] / 100) * 100) 添加到图像的高度。
(您提供的代码只有微小的变化)
差别有点微妙