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

Name Type
domainMin System.Single
domainMax System.Single
rangeMin System.Single
rangeMax System.Single

public abstract float Map(float value)

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

Parameters

Name Type
value System.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

Name Type
position System.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

Name Type
count System.Int32

Returns

System.Single[]

public Scale SetDomain(float min, float max)

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

Parameters

Name Type
min System.Single
max System.Single

Returns

ChartGuru.Scale

public Scale SetRange(float min, float max)

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

Parameters

Name Type
min System.Single
max System.Single

Returns

ChartGuru.Scale

public Scale SetInverted(bool inverted)

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

Parameters

Name Type
inverted System.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

Name Type
clamped System.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