Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Replacing/removing the metric notations like thousands "k" abbreviation

Tags:

My areaspline chart has Y axis values up to approximately 6000. Highcharts automatically changes the "000" part on my Y axis for a "k".

As I'm french and the site is meant to be in that same language, this "k" abbreviation won't make sense in my case and I'd like to have a casual "000" display instead of it.

Is this possible? How?

like image 638
Cécile Fecherolle Avatar asked Jan 17 '13 11:01

Cécile Fecherolle


1 Answers

You can do this by explicitly overriding the lang.numericSymbols* with null in the defaultOptions as follows

Highcharts.setOptions({     lang: {         numericSymbols: null //otherwise by default ['k', 'M', 'G', 'T', 'P', 'E']     } }); 

The documentation reads as follows

numericSymbols: Array<String>

Metric prefixes used to shorten high numbers in axis labels. Replacing any of the positions with null causes the full number to be written. Setting numbericSymbols to null disables shortening altogether. Defaults to ['k', 'M', 'G', 'T', 'P', 'E'].

**officially available from v1.2.0 (2012-08-24)
This won't work before v1.2.0 as the suffixes were hard coded then.*

Alternate solution

(Should work on all versions that support formatter)

Use yAxis.labels.formatter and return the value as it is

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

Disabling metric notation on axis values | Highchart & Highstock (v1.2+) @ jsFiddle
Disabling metric notation on axis values | Highchart & Highstock (old versions) @ jsFiddle

like image 78
Jugal Thakkar Avatar answered Apr 05 '23 12:04

Jugal Thakkar