Table of Contents

Class ChartScale

Namespace
TwBlazor.Charting
Assembly
TwBlazor.dll

A linear scale that maps a data value to a percentage (0 to 100) of an axis, with round tick values.

public sealed class ChartScale
Inheritance
ChartScale
Inherited Members

Properties

Max

Gets the value at the end of the axis.

public double Max { get; }

Property Value

double

Min

Gets the value at the start of the axis.

public double Min { get; }

Property Value

double

Ticks

Gets the tick values, evenly spaced from Min to Max.

public IReadOnlyList<double> Ticks { get; }

Property Value

IReadOnlyList<double>

Methods

Map(double)

Maps a data value to its percentage along the axis.

public double Map(double value)

Parameters

value double

The data value.

Returns

double

Nice(IEnumerable<double>, bool)

Creates a scale that covers a set of values. See Nice(double, double, bool, int).

public static ChartScale Nice(IEnumerable<double> values, bool includeZero = true)

Parameters

values IEnumerable<double>

The data values.

includeZero bool

Whether the scale must include zero.

Returns

ChartScale

Nice(double, double, bool, int)

Creates a scale that covers a range of values and starts, ends and ticks on round numbers.

public static ChartScale Nice(double min, double max, bool includeZero = true, int tickTarget = 5)

Parameters

min double

The smallest data value.

max double

The largest data value.

includeZero bool

Whether the scale must include zero. Bars need this so their length stays honest.

tickTarget int

Roughly how many intervals to aim for.

Returns

ChartScale

NiceStep(double)

Rounds a raw interval up to the nearest 1, 2 or 5 times a power of ten.

public static double NiceStep(double raw)

Parameters

raw double

The raw interval.

Returns

double