I am working with HighChart and I need to format a currency value in a specific format.
Example -> XX.XXX.XXX, XX €
I am using this function in highchart to format the value correctly:
formatter: function () {
return parseFloat (this.total, 10) .toFixed (2) .replace (/ (\ d) (? = (\ d {3}) + \.) / g, '$ 1,'). toString () + ' € ';
}
The problem is that I am not getting the points and commas to match as I intend.
Example for values:
Given -> 1052325
Expected -> 10.523,25 €
Current value obtained -> 10,523.25
I could do a new replace() and change the commas for the points, but I would like to know how to do it right away at REGEXP.
Thank you very much
Ok. I cant use some of the functions in HighChart.
I try this code in the ppotaczek example
}] });
The code works in the Fiddle example, but it doesn't work when I put it in the Highchart Json.
I tried another approach now, I always have this string format so I just want to replace the third character from the end of the string.
For this I am using this replace with regexp:
It works and replaces well. The problem is that it is always at the last character of the string. I wanted it to go to the third character after the end of the string.
Best regards