Forum Replies Created by michael_t

Viewing 3 posts - 1 through 3 (of 3 total)
  • Thanks for your quick response.

    This is a solution and should solve the issues to my knowledge.
    For every format string I could test yet, it actually does.

    Michael T.

    Mhm.

    What I presented above is still not a perfect solution. It disregards the possibility of zeros in the part after the decimal separator.

    This could be corrected by an additional variable (and two additional lines of code) that counts the number of zeros after the decimal separator.

    With kind regards,
    Michael T.

    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;

    I changed it to the following:
    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! :)

Viewing 3 posts - 1 through 3 (of 3 total)