Search code examples
highcharts

HighCharts: How to change style of bottom line color


enter image description here I want to change the color of the line to black one as you can see above

this is my code of that part which draws highcharts.

enter image description here I thought I needed to fix it in the type:'area' and I've tried to set the type area and read API as much as I can but I couldn't solove the problem

plz anybody help me


Solution

  • The line that you want to change is a yAxis gridline. Since there is no API option to change a single gridline, you need to get access to the proper SVG element and change its attribute.

      chart: {
        events: {
          load: function() {
            const yAxis = this.yAxis[0];
            const firstTick = yAxis.ticks[yAxis.tickPositions[0]];
    
            firstTick.gridLine.attr({
              stroke: '#000',
              'stroke-width': 1
            });
          }
        }
      }
    

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

    API Reference: https://api.highcharts.com/class-reference/Highcharts.SVGElement#attr