Home › Forums › Report Bugs › Number Formatting: Decimal Point after scaled number with suffix › Reply To: Number Formatting: Decimal Point after scaled number with suffix
Okay, I just took a look at the source code and managed to fix the problem by myself.
Line 1079 (in canvasjs.js of version 1.4) says up to now: result += (charCount++ === 0 ? decimalSeparator : "") + match;
result += (charCount++ === 0 ? decimalSeparator : "") + match;
I changed it to the following: result += ((charCount++ === 0 && vStringAfterDecimal.length > 0 && Number(vStringAfterDecimal.join("")) !== 0 && noPhAfterDecimal) ? decimalSeparator : "") + match;
result += ((charCount++ === 0 && vStringAfterDecimal.length > 0 && Number(vStringAfterDecimal.join("")) !== 0 && noPhAfterDecimal) ? decimalSeparator : "") + match;
This will cause the number formatting function to add the decimalSeparator on non-placeholder-characters only if one or more placeholders will follow AND the value to show after decimal separator is greater than 0. I hope this solution won’t cause any other issues.
So, maybe you could include this fix into the main release.
With kind regards, Michael T.
PS: By the way: Thanks for the great work! :)