Chartjs-How to draw dotted line vertical line at 0 postiion in highChart

1👍

You can add a dotted line on an axis by using the plotLines. Like this:

yAxis: {
  plotLines: [{
    color: '#FF0000',
    value: 0,
      dashStyle: 'dot',
  width: 5
  }]
},

Here added to the yAxis to create a vertical line:

Highcharts.chart('container', {
  chart: {
    type: 'bar'
  },

  legend: {
    symbolWidth: 80
  },

  plotOptions: {
    series: {
      color: '#000000',
    }

  },
  yAxis: {
    plotLines: [{
    color: '#FF0000',
      value: 0,
      dashStyle: 'dot',
      width: 5
    }]
  },

  series: [{
    data: [1, 3, 2, 4, 5, 4, -6, 2, 3, 5, 6],

  }, {
    data: [2, 4, 1, 3, 4, 2, 9, 1, 2, 3, 4, 5],

  }]
});
<script src="https://code.highcharts.com/highcharts.js"></script>

<div id="container" style="height: 400px"></div>

Leave a comment