Skip to main content
cngx-src documentation

createTimeScale

Functioncommon/chart/scales

projects/common/chart/scales/time.ts

Description#

Pure-TS time scale. Reuses createLinearScale after coercing Date endpoints (and inputs) to epoch milliseconds. Supports inverted domains and bare-number timestamps interchangeably.

Signature#

createTimeScale(domain, range)

Parameters#

@paramdomain

[start, end] time range. Date and number are interchangeable on either endpoint.

@paramrange

[start, end] output range (typically pixel coordinates).

Returns#

number

(v: Date | number) => number mapping time values to range values.