在高图中设置列组图的背景颜色

问题描述 投票:0回答:1

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

enter image description here

javascript jquery highcharts
1个回答
0
投票

我认为使用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

© www.soinside.com 2019 - 2024. All rights reserved.