user882670
user882670

Reputation:

Highcharts y axis thousands separator

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

This is what I have:

yAxis: [{ // Primary yAxis
                labels: {
                    

Upvotes: 11

Views: 17303

Answers (3)

adinas
adinas

Reputation: 4550

Code to format with comma

var UNDEFINED;

Highcharts.chart(...

...

yAxis: {
       labels: {
              formatter: function () {
                     return Highcharts.numberFormat(this.value, -1, UNDEFINED, ',');
                                     }
               }
       }

Upvotes: 0

futantan
futantan

Reputation: 21

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

Highcharts.setOptions({
  lang: {
    thousandsSep: ','
  }
});

Upvotes: 0

falsarella
falsarella

Reputation: 12437

In addition to what @jfrej suggested:

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

yAxis: {
    labels: {
        format: '{value:,.0f} €'
    }
}

Upvotes: 10

Related Questions