简体   繁体   中英

add background color to highcharts stacked Bar Chart

How i can add background color to highcharts stacked Bar Chart column like in picture

在此处输入图像描述

I have try find in highcharts official documentation but unfortunately cant find.

There is no straight way from the API to create such a shadow background for a stacked bar chart, but you can create it as a dummy series with disabled enableMouseTracking and showInLegend options.

Sample code:

  plotOptions: {
    bar: {
      stacking: 'percent'
    }
  },
  series: [{
      color: '#ddd',
      enableMouseTracking: false,
      showInLegend: false,
      data: [7, 7]
    }, {
      data: [1, 1]
    },
    {
      data: [2, 2]
    }
  ]

Demo: http://jsfiddle.net/BlackLabel/82svfyxt/

API References: https://api.highcharts.com/highcharts/series.bar.showInLegend https://api.highcharts.com/highcharts/series.bar.enableMouseTracking

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM