How to add a thousands separator to the Y Axis of Highcharts?
This is what I have:
yAxis: [{ // Primary yAxis
labels: {
How to add a thousands separator to the Y Axis of Highcharts?
This is what I have:
yAxis: [{ // Primary yAxis
labels: {
Share
Improve this question
edited Feb 16, 2021 at 9:43
asked Nov 6, 2013 at 11:29
user882670user882670
1
-
8
Try:
format: '{value:,.0f} €'
– jfrej Commented Nov 6, 2013 at 11:32
3 Answers
Reset to default 10In addition to what @jfrej suggested:
- If you're directly formatting an axis, use
{value}
for bothyAxis
andxAxis
:- Fiddle for
yAxis
format - Fiddle for
xAxis
format
- Fiddle for
- If you're formatting a point in a tooltip, you may want to use
{point.y}
and/or{point.x}
:- Fiddle for
tooltip.pointFormat
- Fiddle for
tooltip.pointFormat
withvalueSuffix
extension
- Fiddle for
- If you're directly formatting the point label, you may want to use
{x}
and/or{y}
:- Fiddle for
plotOptions.series.dataLabels
, formatting all points - Fiddle for
series.data.dataLabels
, formatting specific point
- Fiddle for
So, since you're formatting yAxis
, {value}
should work as expected:
yAxis: {
labels: {
format: '{value:,.0f} €'
}
}
If you find the above solution not working, try to add this:
Highcharts.setOptions({
lang: {
thousandsSep: ','
}
});
Code to format with ma
var UNDEFINED;
Highcharts.chart(...
...
yAxis: {
labels: {
formatter: function () {
return Highcharts.numberFormat(this.value, -1, UNDEFINED, ',');
}
}
}