Interfaces
Public interfaces exported from timescope.
TimescopePreparedView
Timescope.prepareView() · Guide
Properties
signal Cancellation signal for this draft and its fetch.
- Type
AbortSignal
Methods
setTime(value, animation?)
Method Sets the draft's selected time.
Parameters
valueTimescopeTimeLikeanimation?TimescopeAnimationInput
- Defaults
- Same as Timescope.setTime().
Returns
booleanfalse for invalid input. - Throws
InvalidStateError:fetch()started orabort()called.
setZoom(value, animation?)
Method Sets the draft's zoom level.
Parameters
valueTimescopeNumberLikeanimation?TimescopeAnimationInput
- Defaults
- Same as Timescope.setZoom().
Returns
booleanfalse for invalid input. - Throws
InvalidStateError:fetch()started orabort()called.
setPlaybackTime(value)
Method Sets the draft's playback clock;
null restores wall-clock time.Parameters
valueTimescopeTimeLike
Returns
void- Throws
InvalidStateError:fetch()started orabort()called.
fetch()
MethodLoads required data and activates the prepared view.
- Rejects
InvalidStateError: unmounted, or another view fetching.AbortError: navigation, interaction, option change, resize, or unmount during fetch.
Acquisition error: data acquisition failed.
abort(reason?)
Method Cancels the draft or its active fetch.
Parameters
reason?unknown
- Defaults
reason:AbortError.
Returns
voidTimescopeDataSource
createDataSource() · TimescopeDataSourceBase · Chunk Loading
Properties
chunkSize Preferred number of resolution intervals per query chunk.
- Type
number | ((resolution: Decimal) => number)
chunkOrigin Origin for chunks and aggregation buckets.
- Type
Decimal
resolutions? Preferred loader resolutions; direct queries remain unrestricted.
- Type
readonly Decimal[]
immediate Whether loading is permitted while the view moves.
- Type
boolean
cacheSize? Number of inactive query results retained;
0 disables retention. - Type
number
revision Current source revision.
- Type
number
invalidation? Latest invalidation range and revision.
Methods
query(request)
MethodQueries a finite range at a positive resolution; no chunk alignment required.
Parameters
requestTimescopeDataSourceQuery
Returns
Promise<readonly TimescopeDataRow[]> Points:
Intervals:
Aggregates return whole buckets; response requirements.
start <= time && time < end.Intervals:
rowStart < end && start < rowEnd, without trimming.Aggregates return whole buckets; response requirements.
invalidate(range?)
Method Notifies consumers of changed data;
undefined endpoints are unbounded.Parameters
range?TimescopeRange<TimescopeTimeLike<undefined>>
- Defaults
range: all data.
Returns
void Does not wait for replacement data or drawing.
on('invalidate', handler)
Method Subscribes to source invalidation.
Parameters
handler(event: { type: 'invalidate', value: TimescopeDataSourceInvalidation }) => void
Returns
() => void Unsubscribe function.
dispose?()
Method Releases source resources.
Returns
voidInvalidation
range? Affected range; omitted means all data, and
undefined endpoints are unbounded. - Type
TimescopeRange<Decimal | undefined>
revision Source revision after the change.
- Type
number
Built-in sources reacquire invalidated data on demand; snapshot invalidation replaces the whole snapshot even when a range is supplied. Charts manage their DataSources' lifetime, including shared instances. Keep the same instance across configuration updates to retain loaded data; dispose a standalone source with source.dispose?.() when no longer needed.
Events
invalidate Source data is invalidated or changed.
- Payload
{ type: 'invalidate', value: TimescopeDataSourceInvalidation }
TimescopeAppendOnlyDataSource
ts
interface TimescopeAppendOnlyDataSource extends TimescopeDataSourceMethods
Only 'point-aggregate' sources support appending. Equal-time points retain insertion order. Later snapshot invalidation discards appended points absent from the original input.
append(rows)
Method Appends point rows in nondecreasing time order and refreshes consumers; invalid batches insert nothing.
Parameters
rowsTimescopeDataRowInput | readonly TimescopeDataRowInput[]
Returns
Promise<void> Resolves after the data update, before drawing necessarily completes. Only direct source mappings apply to appended input.