How to create a threshold in highcharts ng

289 views Asked by At

I have a simple line chart with highchart ng the problem is that I cannot set the threshold to zero the threshold property according to the highcharts api should be plotoption.series.threshold also according to this answer it should be under plotoptions but as you can see in my jsfiddle it seems not to work for me. what I want here to do is to move the x-axis to the point 0 where all the negative values show after the x-axis

code:

 $scope.highchartsNG = {
    options: {
      chart: {
        type: 'line'
      },
      plotOptions: {
      line: {

      },
        series: {
          threshold: 3
        }
      }
    },
    series: [{
      data: [10, 15, 12, 8, -7]
    }],
    title: {
      text: 'Hello'
    },
    loading: false
  }
1

There are 1 answers

0
Sajeetharan On BEST ANSWER

You cannot do with plot Options see here

plotOptions: {
            series: {
                threshold:0,
                 negativeColor: 'green'
            }
        },

Example

You can try using plotLines for x-axis,

yAxis: {
            title: {
                text: 'dBmV'
            },
            plotLines: [{
                value: 0,
                width: 2,
                color: 'green'
            }]
        },

DEMO