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

Name Type
categories System.String[]
rangeMin System.Single
rangeMax System.Single

public BandScale SetRange(float min, float max)

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

Parameters

Name Type
min System.Single
max System.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

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

Name Type
padding System.Single

Returns

ChartGuru.BandScale

public BandScale SetPadding(float padding)

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

Parameters

Name Type
padding System.Single

Returns

ChartGuru.BandScale

public float Map(string category)

Map a category to its band start position.

Parameters

Name Type
category System.String

Returns

System.Single

public float Map(int index)

Map a category index to its band start position.

Parameters

Name Type
index System.Int32

Returns

System.Single

public float MapCenter(string category)

Get the center of a band for the category.

Parameters

Name Type
category System.String

Returns

System.Single

public float MapCenter(int index)

Get the center of a band for the index.

Parameters

Name Type
index System.Int32

Returns

System.Single

public int Invert(float position)

Find which category contains the given position.

Parameters

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