Highcharts x轴分组显示

<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://blacklabel.github.io/grouped_categories/grouped-categories.js"></script>

<div id="container" style="min-width: 310px; height: 400px; margin: 0 auto"></div>

样式一: 

Highcharts.chart('container', {
  chart: {
    type: 'column'
  },
  title: {
    text: ''
  },
  credits: {
    enabled: false
  },
  xAxis: {
    plotBands: [{
      id: 'first-category',
      color: '#A9CDD9',
      from: -0.5,
      to: 2.5
    }, {
      id: 'second-category',
      color: '#A9D9BB',
      from: 2.5,
      to: 6.5
    }],
    categories: [{
      name: 'First',
      categories: ['One', 'Two', 'Three']
    }, {
      name: 'Second',
      categories: ['Four', 'Five', 'Six', 'Seven']
    }],
    labels: {
      rotation: 0
    }
  },
  yAxis: {
    title: {
      text: ''
    }
  },
  series: [{
    data: [10, 10, 10, 10, 10, 10, 10]
  }]
});

3b5c0de1da7ff3b8089100c3ac6e2dd8d9d.jpg

样式二:

        columnChart.chartConfig.xAxis.plotBands = [
            {
                from:0,
                to:3,
                borderColor:$rootScope.deepxray_app.color.danger,
                borderWidth:1,
                label:{
                    text:"区域1",
                }
            },
            {
                from:3.1,
                to:7,
                borderColor:$rootScope.deepxray_app.color.success,
                borderWidth:1,
                label:{
                    text:"区域1",
                }
            }
        ]

e34b889bd36b47c1ec3d0a2e019bf743408.jpg

 

plotBands API:https://api.hcharts.cn/highcharts#xAxis.plotBands.borderWidth

转载于:https://my.oschina.net/u/2391658/blog/1925857

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值