在设置x轴时,需要加上gridLines属性并设为横向,可以参考以下代码示例:
xaxis: {
type: 'datetime',
gridLines: {
show: true,
offsetY: -1,
strokeDashArray: 0,
horizontalLines: {
show: true,
strokeDashArray: 0,
}
}
}
其中,horizontalLines属性就是关键,设为true后就能在x轴上显示横向的水平线了。