首页 > 解决方案 > 为 highcharts 中的列组图设置背景颜色

问题描述

我在 highchart JavaScript 库中有一个用于 4 个不同数据的列组图表。我想每个月为每个特定数据设置背景颜色,但不幸的是,我没有找到任何可以为我呈现它的相关代码。如果你能帮助我,我会非常高兴。

在此处输入图像描述

标签: javascriptjqueryhighcharts

解决方案


我认为使用plotBands功能可能是您的情况的一个很好的解决方案。

演示:https ://jsfiddle.net/BlackLabel/ta9L4zfx/

  xAxis: {
    plotBands: [{
        from: -0.35,
      to: 0.35,
      color: 'gray'
    }, {
        from: 0.65,
      to: 1.35,
      color: 'gray'
    }, {
        from: 1.65,
      to: 2.35,
      color: 'gray'
    }]
  },

API:https ://api.highcharts.com/highcharts/xAxis.plotBands.events


推荐阅读