Class OrdinalScale<T>
Namespace: VelloSharp.Charting.Scales
Assembly: VelloSharp.Charting.dll
Projects discrete categorical values onto evenly spaced unit coordinates.
public sealed class OrdinalScale<T> : IScale<T>, IScale where T : notnull
Type Parameters
T
Inheritance
Implements
Inherited Members
object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.ReferenceEquals(object?, object?), object.ToString()
Constructors
OrdinalScale(IEnumerable<T>, bool, IEqualityComparer<T>?)
public OrdinalScale(IEnumerable<T> values, bool clampToDomain = true, IEqualityComparer<T>? comparer = null)
Parameters
values
IEnumerable<T>
clampToDomain
bool
comparer
IEqualityComparer<T>?
Properties
Categories
Gets the categories in their defined order.
public IReadOnlyList<T> Categories { get; }
Property Value
ClampToDomain
Gets a value indicating whether inputs are clamped to the domain when projected.
public bool ClampToDomain { get; }
Property Value
Domain
Gets the scale domain range.
public Range<T> Domain { get; }
Property Value
Range<T>
DomainType
Gets the underlying domain value type.
public Type DomainType { get; }
Property Value
Kind
Gets the scale family.
public ScaleKind Kind { get; }
Property Value
Methods
Project(T)
Projects the provided value into normalized unit space (0..1).
public double Project(T value)
Parameters
value
T
Returns
TryProject(T, out double)
Attempts to project the provided value into unit space without throwing.
public bool TryProject(T value, out double unit)
Parameters
value
T
unit
double
Returns
Unproject(double)
Converts a normalized unit value back into domain space.
public T Unproject(double unit)
Parameters
unit
double
Returns
T