The Visualization Editor accepts composite format strings as input. The formatting operation yields a result string that consists of the original fixed text intermixed with the string format representation. This makes the values in visualization easy to read and more understandable.
The general syntax of a formatting command is
{<position>:<format>}
Typically, the position is set to 0.
The format syntax follows .NET String Formatting. Refer to this article for a comprehensive documentation of the format.
More formats
Check out the string formatting cheat sheet http://www.cheat-sheets.org/saved-copy/msnet-formatting-strings.pdf
Examples
Numeric Formats
Applying some custom numeric format strings to specific data types and values. In this example we will change the text format of a temperature:
format string | value example | result |
---|---|---|
{0:p} or {0:P} | 1 | 100.00% |
{0:00.0} °C | 22.3 | 22.3 °C |
DateTime Formats
DateTime formats typically depend on system localization settings.
format string | value example | result |
---|---|---|
{0:d} | 2020-12-10 | 12/10/2020 (short date) |
{0:dddd} | 2018-09-19 | Wednesday |
{0:yyyy} | 2018-09-19 | 2018 |