saumj
saumj

Reputation: 171

Get x and y value of a series in highcharts when curve is being plotted

I am using a custom formatter for yAxis in highcharts. The following gives me the current y axis value:

yAxis: {
     labels:{
           formatter: function(){
                            return this.value
                      }
             }
}

Is there a way that I can also access the coordinate's x-axis value, and z-axis value inside the formatter function? I can get all the values, but not the corresponding x, and z values.

Upvotes: 0

Views: 485

Answers (1)

Emre Bolat
Emre Bolat

Reputation: 4562

First of all you need to check the chart object from console like this;

yAxis: {
   labels:{
       formatter: function(){
                        console.log(this);
                  }
         }
}

You can find any needed value in this object. For example; this.chart.xAxis[0].categories[0] will give you the value of first element on xAxis.

Upvotes: 1

Related Questions