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 Parameter | Default type |
|---|---|
TDomain | number |
TRange | number |
Scale(
value):TRange
Defined in: packages/core/src/scales/types.ts:7
Maps a value from the input domain to the output range.
Parameters
| Parameter | Type |
|---|---|
value | TDomain |
Returns
TRange
Properties
| Property | Type | Description | Defined in |
|---|---|---|---|
domain | TDomain[] | The input domain the scale maps from. | packages/core/src/scales/types.ts:9 |
inverse | ScaleMethod<TRange, TDomain> | Maps a value from the range back to its corresponding domain value. | packages/core/src/scales/types.ts:13 |
range | TRange[] | 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
| Parameter | Type |
|---|---|
value | TDomain |
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
| Parameter | Type |
|---|---|
count? | number |
Returns
TDomain[]