11

How to add a thousands separator to the Y Axis of Highcharts?

This is what I have:

yAxis: [{ // Primary yAxis
                labels: {
                    

3 Answers3

10

In addition to what @jfrej suggested:

So, since you're formatting yAxis, {value} should work as expected:

yAxis: {
    labels: {
        format: '{value:,.0f} €'
    }
}
Community
  • 1
  • 1
falsarella
  • 12,217
  • 9
  • 69
  • 115
  • 2
    above solution didn't work for me....I even can't see comma in y-axis of fiddle charts – Saurabh Tiwari Jun 16 '16 at 12:59
  • 1
    @SaurabhTiwari those are just *formatting* fiddle examples provided by Highcharts. You might need to tweak the examples to fulfill your requirements. The last excerpt of my answer suggests the usage tweak related to OP's requirements, which might also work for you. – falsarella Jun 16 '16 at 14:12
0

If you find the above solution not working, try to add this:

Highcharts.setOptions({
  lang: {
    thousandsSep: ','
  }
});
futantan
  • 21
  • 2
0

Code to format with comma

var UNDEFINED;

Highcharts.chart(...

...

yAxis: {
       labels: {
              formatter: function () {
                     return Highcharts.numberFormat(this.value, -1, UNDEFINED, ',');
                                     }
               }
       }
adinas
  • 4,150
  • 3
  • 37
  • 47