Skip to content
EliteChart

Scale

Documentation


Documentation / @elitechart/core / Scale

Defined in: math/scales.ts:49

Generic scale contract — bidirectional mapping between a numeric domain and a pixel range.

Example

code
import { LinearScale, type Scale } from '@elitechart/core';
const s: Scale = new LinearScale({ min: 0, max: 100 }, { start: 0, end: 500 });
s.scale(50);    // 250
s.invert(250);  // 50

Properties

domain

code
readonly domain: Domain;

Defined in: math/scales.ts:50


range

code
readonly range: Range;

Defined in: math/scales.ts:51

Methods

invert()

code
invert(px): number;

Defined in: math/scales.ts:55

Map a pixel back to the domain.

Parameters

px

number

Returns

number


scale()

code
scale(value): number;

Defined in: math/scales.ts:53

Map a domain value to a pixel position.

Parameters

value

number

Returns

number