24

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?

Jugal Thakkar
  • 13,432
  • 4
  • 61
  • 79
Cécile Fecherolle
  • 1,695
  • 3
  • 15
  • 32
  • 3
    The "k" abbreviation _does_ make sense in French, as it is part of the [préfixes du système international d'unités](http://fr.wikipedia.org/wiki/Pr%C3%A9fixes_du_syst%C3%A8me_international_d%27unit%C3%A9s), which, by the way, was first implemented in France. – R. Schreurs Apr 10 '15 at 13:28

2 Answers2

43

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

Jugal Thakkar
  • 13,432
  • 4
  • 61
  • 79
  • This is a good explanation.But is there any means to represent the Y axis data in Indian number format? – Gopinagh.R Jan 17 '13 at 12:44
  • 1
    Thank you, it's exactly what I wanted to do. Thanks also for editing my question, I see now it was not as clear as I thought. – Cécile Fecherolle Jan 17 '13 at 13:54
  • 1
    @Gopinagh, yes you can of course write your own formatter. Add http://syedabdulbaqi.wordpress.com/2009/03/10/javascript-function-for-converting-string-into-indian-currency-format/ to the existing fiddle and you get http://jsfiddle.net/jugal/hm4Bh/1/ If you are talking about Lakhs, Crores, etc. then that can be done too in a similar way – Jugal Thakkar Jan 17 '13 at 13:59
0

Based on the answer of @Jugal-Thakkar, I implemented:

numericSymbols: [' × 10³', ' × 10⁶', ' × 10⁹', ' × 10¹²', ' × 10¹⁵', ' × 10¹⁸'],

The superscripts 0 and 4-9 are UTF-8 characters only. You need to specify a font that supports these, as otherwise you will have font-substitution issues, as described in Why the display of Unicode characters for superscripted digits are not at the same height?.

I use:

font-family: Lucida Sans Unicode, Arial Unicode MS, Cambria, Calibri, Consolas;

Also, I would rather have 1.8 × 10¹⁴ than 180 × 10¹², but is better than 180000000000000, which is hard to read.

Community
  • 1
  • 1
R. Schreurs
  • 8,587
  • 5
  • 43
  • 62