Replacing/removing the metric notations like thousands “k” abbreviation

故事扮演 提交于 2019-11-30 06:41:30

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

R. Schreurs

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!