0
votes

Expected behaviour: bar / point width should be always same even after showing and hiding a series

Actual behaviour: bars width is not same, middle bar is squeezed.

Live demo with steps to reproduce: access the below fiddle and click on series 2 on legend(enabling), observe width of bars, middle bar's width is not same as others. I think highcharts is trying to fit the bars within the available chart width. how can I make sure bars are having equal width without space between them. I have tried with the below options pointPadding: 0, borderWidth: 0, shadow: false, pointWidth: 10,

https://jsfiddle.net/rammohanreddy201/mugp32hy/5/

`

Highcharts.chart('container', { chart: { type: 'column' }, xAxis: { categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] },

plotOptions: {
    series: {
        pointPadding: 0,
        borderWidth: 0,
        shadow: false,
        pointWidth: 10,
         states: {
         inactive: {
           opacity: 1
         },
         hover: {
           enabled: false
         }
            }
    }
},

series: [{
    data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]
},
{
    data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4],
    visible: false
},
{
    data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]
}]

}); ` Product version 7.x

Affected browser(s) tried with chrome, but is not dependent on browser type

1

1 Answers

0
votes

The columns have the same width, they just overlap. If you want to show entire columns, make more space for them, for example by setting groupPadding to 0.

plotOptions: {
  series: {
    pointPadding: 0,
    groupPadding: 0,
    pointWidth: 10,
    ...
  }
}

Live demo: https://jsfiddle.net/BlackLabel/knm5xvtd/

API Reference: https://api.highcharts.com/highcharts/plotOptions.column.groupPadding