Class MakerChartScale

Namespace
SurvivorsMaker.Editor
Assembly
SurvivorsMaker.Editor.dll

Axis math shared by the charts: "nice" maxima and tick steps (1, 2, 2.5, 5 × 10^n).

public static class MakerChartScale
Inheritance
MakerChartScale
Inherited Members

Methods

Max(IEnumerable<float>)

Largest finite value of the series (0 when empty).

public static float Max(IEnumerable<float> values)

Parameters

values IEnumerable<float>

Returns

float

NearestIndex(float, float, float, int)

Index of the x slot nearest to x for count evenly spaced points over [left, right].

public static int NearestIndex(float x, float left, float right, int count)

Parameters

x float
left float
right float
count int

Returns

int

NiceMax(float)

Smallest nice number ≥ value. Non-positive or invalid values give 1.

public static float NiceMax(float value)

Parameters

value float

Returns

float

Normalize(float, float)

Maps a value to 0–1 on an axis that runs 0..NiceMax(axisMax).

public static float Normalize(float value, float axisMax)

Parameters

value float
axisMax float

Returns

float

NormalizeBetween(float, float, float)

public static float NormalizeBetween(float value, float min, float max)

Parameters

value float
min float
max float

Returns

float

Short(float)

Short axis label: 1.2k, 3.4M.

public static string Short(float value)

Parameters

value float

Returns

string

Ticks(float, int)

Tick values from 0 to NiceMax(max) in divisions equal steps.

public static float[] Ticks(float max, int divisions = 4)

Parameters

max float
divisions int

Returns

float[]