Search code examples
highchartsbar-chartstacked-chart

How to hide the Axis line in stack bar chart high chart


I want to remove the thin Axis line just after legends in a stacked bar chart. How to achieve it?

enter image description here

 xAxis: {
    categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
  lineColor: 'transparent',
   tickWidth: 0,
   tickLength: 0,
   tickColor:'transparent',
   visible:true,
  }

Jsfiddle link https://jsfiddle.net/mehrotrarohit87/51mky0so/1/


Solution

  • There is no such an option in the API, so you need to hide this grid programmatically.

    chart: {
        type: 'bar',
        marginLeft: 50,
        marginBottom: 90,
        gridLineWidth: 0,
                events: {
                    load() {
                        const chart = this;
                        const ticks = chart.yAxis[0].ticks;
                        ticks[0].gridLine.hide()
                    }
                }
    },
    

    Demo: https://jsfiddle.net/BlackLabel/9zpun5ow/