Skip to content

Class: OrdinalTimeScale

Defined in: scales/scale.ts:193

An ordinal time axis — the standard financial x-axis. Bars are plotted at evenly-spaced integer indices 0..n-1 (like CategoricalScale, so the domain is the band [-0.5, n-1+0.5]), which collapses market gaps (weekends, overnight, holidays) instead of leaving blank space the way a real TimeScale would. Each index carries a timestamp; ticks are placed at natural calendar boundaries (day / month / year, or hour / minute when zoomed in) and subsampled toward the target count, so labels stay readable at any zoom.

Plot your candles/bars at x = 0,1,2,… and pass the per-bar epoch-ms times.

Implements

Constructors

Constructor

ts
new OrdinalTimeScale(times?): OrdinalTimeScale;

Defined in: scales/scale.ts:198

Parameters

ParameterTypeDefault value
timesArrayLike<number>[]

Returns

OrdinalTimeScale

Properties

domain

ts
domain: Range;

Defined in: scales/scale.ts:197

Implementation of

Scale.domain


log

ts
readonly log: false = false;

Defined in: scales/scale.ts:195

Implementation of

Scale.log


times

ts
times: number[];

Defined in: scales/scale.ts:196


type

ts
readonly type: "ordinal-time" = "ordinal-time";

Defined in: scales/scale.ts:194

Implementation of

Scale.type

Methods

formatTick()

ts
formatTick(value): string;

Defined in: scales/scale.ts:281

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:207

Parameters

ParameterType
tnumber

Returns

number

Implementation of

Scale.invert


norm()

ts
norm(value): number;

Defined in: scales/scale.ts:203

Parameters

ParameterType
valuenumber

Returns

number

Implementation of

Scale.norm


ticks()

ts
ticks(target?): Tick[];

Defined in: scales/scale.ts:218

Auto ticks appropriate for this scale type.

Parameters

ParameterTypeDefault value
targetnumber6

Returns

Tick[]

Implementation of

Scale.ticks

MIT licensed. WebGL2 required.