Double axis using percentage and absolute value for the same series in Highcharts

I need to use the percentage and absolute value of the Y axis from one series.

There is an example in highchart http://www.highcharts.com/demo/combo-multi-axes , but it uses two different series. For example, I need a value in the Y axis of up to 1000, and on the other Y axis, a percentage of the serial number.

+4
source share
1 answer

You can create a second Y axis and associate it with the first (0th) using the xAxis.linkedTo property. Then, in the label formatter of the second axis of the calculations, to get the percentage.

 yAxis:[{ }, { labels:{ formatter:function(){ var max=this.axis.linkedParent.dataMax, min=this.axis.linkedParent.dataMin, range=max-min; return ((this.value-min)/(range)*100) + ' %'; } }, linkedTo:0, opposite:true } ] 

Double axles | Highchart and Highstock @jsFiddle

+5
source

Source: https://habr.com/ru/post/1444492/


All Articles