Highcharts Rounding Yaxis And Xaxis Digits
I am trying to round yaxis and xaxis down. For example 3843 should be 3.843 on the graph and tooltip show 3.843 k. I have got the tooltip working but cant get it to change the grap
Solution 1:
Use dataLabels
formatter
to achieve desired result
plotOptions: {
area: {
dataLabels: {
useHTML:true,
enabled:true,
formatter:function() {
value=this.y;numericSymbolDetector=Math.abs(this.y);if(numericSymbolDetector>1000) {
value=Highcharts.numberFormat(value/1000, 3, '.', '');
}
returnvalue
},
style: {
color:'#c4c4c4',
font:'5px Trebuchet MS, Verdana, sans-serif'
}
},
//enableMouseTracking:false
},
series: {
lineColor:'#808080'
}
},
Fiddle demonstration
Solution 2:
If you want to display yAxis labels the same way, get rid of the formatter from the yAxis.labels object (then the thousand prefix will display). In case you want to display exact values of the points as yAxis labels, you can update tickPositions
array on load event and format them adequately. Take a look at the example below.
API Reference: http://api.highcharts.com/highcharts/chart.events.loadhttp://api.highcharts.com/highcharts/yAxis.tickPositions
Example: http://jsfiddle.net/ojno8rx1/
Post a Comment for "Highcharts Rounding Yaxis And Xaxis Digits"