NumberFormats Class

Number formats for the tick labels of the scales (ContinuousScale.TickFormat). They use the invariant culture.

public static class NumberFormats

Methods

NameDescription
Default(double)Formats a number with at most 6 significant digits and thousands separators, such as 1,234.5.
Fixed(int)Creates a format with a fixed number of decimals and thousands separators.
Percent(int)Creates a format that shows a ratio as a percentage: 0.25 is 25%.
Si(double)Formats a number with an SI prefix (k, M, G, T...) for the thousands, such as 1.5k or 20M.

Default(double)

NumberFormats.cs

Formats a number with at most 6 significant digits and thousands separators, such as 1,234.5.

public static string Default(double value)

Parameters

value double
The number.

Returns

string The text.

Creates a format with a fixed number of decimals and thousands separators.

public static Func<double, string> Fixed(int decimals)

Parameters

decimals int
The number of decimals.

Returns

Func<double, string> The format.

Percent(int)

NumberFormats.cs

Creates a format that shows a ratio as a percentage: 0.25 is 25%.

public static Func<double, string> Percent(int decimals = 0)

Parameters

decimals int
The number of decimals of the percentage.

Returns

Func<double, string> The format.

Formats a number with an SI prefix (k, M, G, T...) for the thousands, such as 1.5k or 20M.

public static string Si(double value)

Parameters

value double
The number.

Returns

string The text.