1

Just struggling a bit with the numeric notations in Highcharts.

I didn't like the default version with "k" for "thousands". So, while trying to change that, I stumbled over some inconsistencies (in my view; but perhaps/probably just a "I don't see the whole picture"-thing).

So, why does the zero value get the "k" extension too:

enter image description here

That doesn't make sense. There are no "0k", as there are no "0px" in HTML/CSS programming. It just should be "0".

Logically in that case, when I change the units to "thousands" or " 000"

Highcharts.setOptions({
  lang: {
    numericSymbols: [" 000", " 000 000"]
  }
});

it looks like this:

enter image description here

Clearly: same thing, same false display.

So, I guess there is a solution to this, a work-around, or a misunderstanding. Can you help me? Thanks for any hints!

Here is a fiddle.

luftikus143
  • 1,285
  • 3
  • 27
  • 52

2 Answers2

1

0px and 0 are both the same in CSS. 0k seems fine as well when it is consistent with other values, but I guess you can see it differently.

To change this display you could label.formatter like:

  labels: {
    formatter: function(){
      return this.value === 0 ? 0 : this.axis.defaultLabelFormatter.call(this);
    }
  }

This will print "0" for 0 and same as without this code for the rest.

Working example: http://jsfiddle.net/yup311dv/

Community
  • 1
  • 1
Kacper Madej
  • 7,846
  • 22
  • 36
0

You can just pass null to the numericSymbols for the chart to display the full numbers:

Highcharts.setOptions({ lang: { numericSymbols: null } });

Updated Fiddle

Luca Regazzi
  • 1,345
  • 1
  • 11
  • 23
  • Ok. Good to know. However, another inconsistency there: There is a space for the thousand separator for the values "10 000" and above. But not for "5000"... Looks weird. – luftikus143 Jun 01 '16 at 06:45