Skip to content

BandScale

ClassChartGuruChartGuru
public class BandScale

Band scale for categorical data. Maps discrete categories to continuous range.

public BandScale(string[] categories, float rangeMin = 0, float rangeMax = 1)

Creates evenly spaced categorical bands across the output range. A null category array produces an empty scale.

Parameters

NameType
categoriesSystem.String[]
rangeMinSystem.Single
rangeMaxSystem.Single

public BandScale SetRange(float min, float max)

Replaces the output coordinate interval and recalculates band positions and widths.

Parameters

NameType
minSystem.Single
maxSystem.Single

Returns

ChartGuru.BandScale

public BandScale SetPaddingInner(float padding)

Sets the proportional gap between adjacent bands, clamped from zero to one, and recalculates layout.

Parameters

NameType
paddingSystem.Single

Returns

ChartGuru.BandScale

public BandScale SetPaddingOuter(float padding)

Sets the proportional margin before the first and after the last band, clamped from zero to one.

Parameters

NameType
paddingSystem.Single

Returns

ChartGuru.BandScale

public BandScale SetPadding(float padding)

Applies one clamped proportion to both inner gaps and outer margins, then recalculates layout.

Parameters

NameType
paddingSystem.Single

Returns

ChartGuru.BandScale

public float Map(string category)

Map a category to its band start position.

Parameters

NameType
categorySystem.String

Returns

System.Single

public float Map(int index)

Map a category index to its band start position.

Parameters

NameType
indexSystem.Int32

Returns

System.Single

public float MapCenter(string category)

Get the center of a band for the category.

Parameters

NameType
categorySystem.String

Returns

System.Single

public float MapCenter(int index)

Get the center of a band for the index.

Parameters

NameType
indexSystem.Int32

Returns

System.Single

public int Invert(float position)

Find which category contains the given position.

Parameters

NameType
positionSystem.Single

Returns

System.Int32

public string[] Categories { get; }

Returns

System.String[]

public float2 Range { get; }

Returns

Unity.Mathematics.float2

public float Bandwidth { get; }

Returns

System.Single

public float Step { get; }

Returns

System.Single