Highcharts Demo

author(s): Torstein Hønsi

by halloleo

HTML

<script src="https://code.highcharts.com/highcharts.js"></script>

<div id="container"></div>

JavaScript

(function(H) {
  H.wrap(H.PlotLineOrBand.prototype, 'render', function(proceed) {
    var options = this.options,
      start = options.start,
      end = options.end,
      value = options.value;

    var result = proceed.apply(this, arguments);
    if (start && end) {
      if (this.axis.coll === 'yAxis') {
        result.svgElem.attr({
          d: "M " +
            this.axis.chart.xAxis[0].toPixels(start) + " " +
            this.axis.chart.yAxis[0].toPixels(value) + " L " +
            this.axis.chart.xAxis[0].toPixels(end) + " " +
            this.axis.chart.yAxis[0].toPixels(value)
        });
      } else {
        result.svgElem.attr({
          d: "M " +
            this.axis.chart.xAxis[0].toPixels(value) + " " +
            this.axis.chart.yAxis[0].toPixels(start) +
            " L" +
            this.axis.chart.xAxis[0].toPixels(value) + " " +
            this.axis.chart.yAxis[0].toPixels(end)
        });
      }
    }
    return result
  });
}(Highcharts));

Highcharts.chart('container', {
  yAxis: {
    plotLines: [{
      value: 3,
      zIndex: 5,
      color: 'red',
      start: 1,
      end: 4.3
    }]
  },

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

});