在 this question它解释了如何将背景设置为两种颜色(如斑马线)。我的需要是通过相应设置背景颜色来突出显示图表中的时间变化,如下所示:
两个蓝色区域可以标识某件事正在发生的时期,而白色区域则可以标识没有发生的事情。除此之外,我将添加线条和其他图表。
这可以通过传递 Highchart 并突出显示期间的开始日期和结束日期来完成吗? (也许可以使用面积图解决方法?)
最佳答案
您最可能需要的是 plotBands
xAxis.plotBands
A colored band stretching across the plot area marking an interval on the axis.
In a gauge, a plot band on the Y axis (value axis) will stretch along the perimiter of the gauge.
plotBands 可以添加到任一轴上,在您的情况下,您似乎希望将其添加到 xAxis 上,以下是如何做到这一点
xAxis: {
plotBands: [{
color: '#FCFFC5',
from: Date.UTC(2010, 0, 2),
to: Date.UTC(2010, 0, 4)
}]
}
关于javascript - HighChart 中的图表背景突出显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19186249/