Skip to content

Class: CategoricalScale

Defined in: scales/scale.ts:152

A categorical (factor) axis. Internally it is linear over a band domain[-0.5, n-0.5], so factor i sits at the band centre and norm(i) equals the ordinary linear projection — the GPU transform needs no special handling, and a layer plotting at integer indices lands on band centres automatically. "Categorical-ness" lives only in the ticks/labels (one per factor).

Implements

Constructors

Constructor

ts
new CategoricalScale(factors?): CategoricalScale;

Defined in: scales/scale.ts:157

Parameters

ParameterTypeDefault value
factorsstring[][]

Returns

CategoricalScale

Properties

domain

ts
domain: Range;

Defined in: scales/scale.ts:156

Implementation of

Scale.domain


factors

ts
factors: string[];

Defined in: scales/scale.ts:155


log

ts
readonly log: false = false;

Defined in: scales/scale.ts:154

Implementation of

Scale.log


type

ts
readonly type: "categorical" = "categorical";

Defined in: scales/scale.ts:153

Implementation of

Scale.type

Methods

formatTick()

ts
formatTick(value): string;

Defined in: scales/scale.ts:175

Default label formatter for a tick value.

Parameters

ParameterType
valuenumber

Returns

string

Implementation of

Scale.formatTick


invert()

ts
invert(t): number;

Defined in: scales/scale.ts:168

Parameters

ParameterType
tnumber

Returns

number

Implementation of

Scale.invert


norm()

ts
norm(value): number;

Defined in: scales/scale.ts:162

Parameters

ParameterType
valuenumber

Returns

number

Implementation of

Scale.norm


ticks()

ts
ticks(): Tick[];

Defined in: scales/scale.ts:172

Auto ticks appropriate for this scale type.

Returns

Tick[]

Implementation of

Scale.ticks

MIT licensed. WebGL2 required.