Skip to content

Scale

ClassChartGuruChartGuru
public abstract class Scale

Base class for all scale types. Maps data values to visual positions.

protected float2 _domain

Returns

Unity.Mathematics.float2

protected float2 _range

Returns

Unity.Mathematics.float2

protected bool _inverted

Returns

System.Boolean

protected bool _clamped

Returns

System.Boolean

public Scale(float domainMin, float domainMax, float rangeMin, float rangeMax)

Initializes the input data domain and output visual range. Scales clamp mapped values by default.

Parameters

NameType
domainMinSystem.Single
domainMaxSystem.Single
rangeMinSystem.Single
rangeMaxSystem.Single

public abstract float Map(float value)

Maps a value from the scale’s input domain into its configured output range.

Parameters

NameType
valueSystem.Single

Returns

System.Single

public abstract float Invert(float position)

Reverses the axis mapping so larger values are laid out toward the opposite edge.

Parameters

NameType
positionSystem.Single

Returns

System.Single

public abstract float[] GenerateTicks(int count)

Generates readable tick values spanning the active domain, targeting the requested count without exceeding scale constraints.

Parameters

NameType
countSystem.Int32

Returns

System.Single[]

public Scale SetDomain(float min, float max)

Replaces the input data interval used by subsequent mapping and tick generation.

Parameters

NameType
minSystem.Single
maxSystem.Single

Returns

ChartGuru.Scale

public Scale SetRange(float min, float max)

Replaces the output coordinate interval, typically expressed in plot-area pixels.

Parameters

NameType
minSystem.Single
maxSystem.Single

Returns

ChartGuru.Scale

public Scale SetInverted(bool inverted)

Controls whether increasing domain values map toward the opposite end of the output range.

Parameters

NameType
invertedSystem.Boolean

Returns

ChartGuru.Scale

public Scale SetClamped(bool clamped)

Controls whether out-of-domain inputs stop at the output bounds or extrapolate beyond them.

Parameters

NameType
clampedSystem.Boolean

Returns

ChartGuru.Scale

public float2 Domain { get; }

Returns

Unity.Mathematics.float2

public float2 Range { get; }

Returns

Unity.Mathematics.float2

public bool Inverted { get; }

Returns

System.Boolean

public bool Clamped { get; }

Returns

System.Boolean