Chart: changing decimal separator of values of points

Hi,

I know that there are many similar topics like this one but it seems to me that all of them solve other issues than mine.

I have a column chart. I need to place values of every column on the top of it. As far it is easy. But I want to use other decimal point and thousands separator than standard; in my case - a comma and a space (instead of a dot and a comma).

There are many hints, how to adjust tooltips - just put a piece of JSON in HighchartsJSON parameter of AdvancedFormat_Init:

tooltip: {
        formatter: function () {
            return '' + this.x  + ' = ' + Highcharts.numberFormat(this.y, 2, ',', ' ');
        }
    },

And it works. Thera are also many hints that I should use "lang" to change formatting of values:

lang: {
        decimalPoint: ',',
        thousandsSep: ' '
},

but it seems to not working. Look at the attached printscreen: you can see a sample of tooltip - as expected. But you can also see that the values of columns are still in the standard format.

What should I do, what should I use to get values with spaces and commas?

Regards

Tomasz

Hi Tomasz,


I just gave this a try, and turns out you can use a formatter calback on the datalabels as well.

See attached oml


SyntaxEditor Code Snippet

"
tooltip: {
        formatter: function () {
            return '' + this.x  + ' : ' + Highcharts.numberFormat(this.y, 2, ',', ' ');
        }
    },
plotOptions: {
        column: {
            dataLabels: {
                enabled: true,
                formatter: function () {
                    return '' + Highcharts.numberFormat(this.y, 2, ',', ' ');
                }
            }
        }
    }

"





Hi Dorine,

Thanks for the tip. We are getting closer and closer :-)

Now I can see that I've supplied not a complete set of information. My chart is to be a column chart of the StackingType: Stacked. "Your" formatting formats values of each of the series (numbers inside color rectangles - see the attachment). But I need to format the total value, the numbers that are displayed above the whole column. As you can see, it is still improperly formatted.

Any further hint is highly appreciated. The precise question is: what element of this huge JSON configuration is responsible for formatting the total column values?

Regards

Tomasz

Solution

Hi Tomasz,

you'd have to add a formatter callback function to the stacklabel of the y-axis

I find the api documentation of highcharts very useful for this type of questions

so add following in your AdvancedFormat_Init:


yAxis: {
       stackLabels: {
            formatter: function () {
                    return '' + Highcharts.numberFormat(this.total, 2, ',', ' ');
            },
            enabled: true
        }
    },


and this is result i got :



enjoy, and if this solves it, please mark my answer as solution.

Dorine


Solution

HI Dorine,

This was exactly what I needed. Thanks a lot.

Regards

Tomasz