Skip to content
EliteChart

LinearScale

Documentation


Documentation / @elitechart/core / LinearScale

Defined in: math/scales.ts:88

Linear scale: px = start + (value - min) / (max - min) * (end - start). Use for time axes and arithmetic price axes.

Example

code
import { LinearScale } from '@elitechart/core';
const time = new LinearScale(
  { min: Date.UTC(2026, 0, 1), max: Date.UTC(2026, 0, 31) },
  { start: 0, end: 1000 },
);
time.scale(Date.UTC(2026, 0, 16)); // ~500

Implements

Constructors

Constructor

code
new LinearScale(domain, range): LinearScale;

Defined in: math/scales.ts:94

Parameters

domain

Domain

range

Range

Returns

LinearScale

Properties

domain

code
readonly domain: Domain;

Defined in: math/scales.ts:89

Implementation of

Scale.domain


range

code
readonly range: Range;

Defined in: math/scales.ts:90

Implementation of

Scale.range

Methods

invert()

code
invert(px): number;

Defined in: math/scales.ts:107

Map a pixel back to the domain.

Parameters

px

number

Returns

number

Implementation of

Scale.invert


scale()

code
scale(value): number;

Defined in: math/scales.ts:103

Map a domain value to a pixel position.

Parameters

value

number

Returns

number

Implementation of

Scale.scale