Class ChartScale
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
Min
Gets the value at the start of the axis.
public double Min { get; }
Property Value
Ticks
public IReadOnlyList<double> Ticks { get; }
Property Value
Methods
Map(double)
Maps a data value to its percentage along the axis.
public double Map(double value)
Parameters
valuedoubleThe data value.
Returns
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
valuesIEnumerable<double>The data values.
includeZeroboolWhether the scale must include zero.
Returns
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
mindoubleThe smallest data value.
maxdoubleThe largest data value.
includeZeroboolWhether the scale must include zero. Bars need this so their length stays honest.
tickTargetintRoughly how many intervals to aim for.
Returns
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
rawdoubleThe raw interval.