Pre loader

Text formatting does not work well


yAxis.textFormatting = “%f”
First image file is the result of this code.

yAxis.textFormatting = “0.00000000”
Second image file is the result of this code.

First code doesn’t work, even it is just a sample code in document.
Second code works, but I want flexible trailing zeros.
How can I do?

  • You must to post comments

Hello, Minsub Kim.
Thank you for your interest in SciChart.

In the first case, formatting is not fully correct. And the second case works as expected.
Let me explain, in more details:
‘textFormatting’ property is used by NSNumberFormatter object under the hood, and NSNumberFormatter – accepts format patterns based on Unicode Technical Standard #35.
So ‘0’ symbol in number format string means, that digit will be always displayed (odd zero in case if actual digit is absent). If you want flexible trailing zeros use ‘#’ symbol instead of ‘0’. For example ‘0.0##’ format will convert 2.3345 number to 12.334, and 1.2 number will be displayed as is.

If you want to build more advanced formats – here is a link to Unicode Technical Standard #35 and NSNumberFormatter documentation.

Hope, this information will help.
Best Regards,

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.

Try SciChart Today

Start a trial and discover why we are the choice
of demanding developers worldwide

Start TrialCase Studies