Skip to content

Documentation / @ripl/core / Scale

Interface: Scale()<TDomain, TRange>

Defined in: packages/core/src/scales/types.ts:5

A callable scale with domain, range, inverse mapping, tick generation, and inclusion testing.

Extended by

Type Parameters

Type ParameterDefault type
TDomainnumber
TRangenumber

Scale(value): TRange

Defined in: packages/core/src/scales/types.ts:7

Maps a value from the input domain to the output range.

Parameters

ParameterType
valueTDomain

Returns

TRange

Properties

PropertyTypeDescriptionDefined in
domainTDomain[]The input domain the scale maps from.packages/core/src/scales/types.ts:9
inverseScaleMethod<TRange, TDomain>Maps a value from the range back to its corresponding domain value.packages/core/src/scales/types.ts:13
rangeTRange[]The output range the scale maps to.packages/core/src/scales/types.ts:11

Methods

includes()

includes(value): boolean

Defined in: packages/core/src/scales/types.ts:17

Tests whether a value falls within the scale's domain.

Parameters

ParameterType
valueTDomain

Returns

boolean


ticks()

ticks(count?): TDomain[]

Defined in: packages/core/src/scales/types.ts:15

Generates approximately count evenly spaced tick values across the domain.

Parameters

ParameterType
count?number

Returns

TDomain[]