0๐
I had to convert the comma in decimal Totalen to a period!
@foreach (var m in Model.Grafieks)
{
@:Maanden.push("@m.maand" + "-" + "@m.jaar");
<text>bedrag = parsePotentiallyGroupedFloat("@m.Total");</text>
@:Totalen.push(bedrag);
}
function parsePotentiallyGroupedFloat(stringValue) {
stringValue = stringValue.trim();
var result = stringValue.replace(/[^0-9]/g, '');
if (/[,\.]\d{2}$/.test(stringValue)) {
result = result.replace(/(\d{2})$/, '.$1');
}
return parseFloat(result);
}
The function "parsePotentiallyGroupedFloat" is from here: Convert String with Dot or Comma as decimal separator to number in JavaScript
- Chartjs-How to remove left and right padding from the canvas/chart?
- Chartjs-Chartisan/Laravel โ > "Call to undefined method" error
Source:stackexchange.com