Skip to content

Timescope Options

Reference for TimescopeOptions used by new Timescope(options?), setOptions(), and updateOptions().

Constructor-only fields are listed in Timescope. The following keys are configurable via TimescopeOptions, setOptions(), and updateOptions():

KeyTypeDescription
style{ width?, height?, background? }Canvas sizing and background.
paddingnumber[]Canvas padding [top, right, bottom, left].
indicatorbooleanShow cursor indicator. (default: true)
showFpsbooleanShow FPS overlay.
sources{ [name: string]: ... }Data providers (see Sources).
series{ [name: string]: ... }Series configuration (see Series).
tracks{ [name: string]: ... }Track layout (see Track configuration).
selectionboolean | SelectionOptionsSelection overlay (see Selection).

Sources

TypeDescription
Array, { data }Inline data array.
string, { url }URL to JSON endpoint.
function, { loader }Async loader (chunk, api) => Promise<data>.

Options:

  • chunkSize — Horizontal span in pixels (default: 256).
  • zoomLevels — Data zoom levels. When specified, data is requested only at these discrete zoom levels.

WARNING

When zoomLevels is configured, consider setting zoomRange to prevent excessive requests.

URL string

URL strings support the following placeholders:

  • {z} / {zoom} — Zoom level.
  • {r} / {resolution} — Time units per pixel.
  • {s} / {start} — Start time of chunk.
  • {e} / {end} — End time of chunk.

URLs containing placeholders trigger chunk-based loading. URLs without placeholders are fetched once for the entire dataset.

Loader signature

TypeScript
(chunk, api) => Promise<data | Response>

Arguments:

  • chunk.range[start, end] time range.
  • chunk.resolution — Time units per pixel.
  • chunk.zoom — Zoom level.
  • api.expiresAt(Date) — Set cache expiry (absolute).
  • api.expiresIn(ms) — Set cache expiry (relative).

Return data or Response. null for no data.

Series

TypeScript
series: {
  humidity: {
    data: {
      source: 'sensor',
      parser?: (rows) => rows,
      time?: string | {...},
      value?: string | {...},
      name?: string,
      unit?: string,
      digits?: number,
      color?: string,
      range?: number | [number, number] | { auto?: boolean; default?: [number, number] },
      instantaneous?: { using?: string | string[]; zoom?: number },
    },
    chart?: 'lines' | 'linespoints:filled' | ... | {
      marks?: [...],
      links?: [...],
    },
    tooltip?: boolean | { label?: string; format?: () => string },
    yAxis?: 'left' | 'right' | { side?: 'left' | 'right'; label?: string },
    track?: string,
  },
}
KeyTypeDescription
data.sourcestringSource name from options.sources.
data.parser(rows) => any[]Transform raw data. Must return an array. Optional when data structure matches expected format.
data.timestring | { start: string; end?: string }Map rows to time fields. Defaults to 'time'.
data.valuestring | { value: string; min?: string; max?: string }Map rows to numeric fields. Defaults to 'value'.
data.namestringSeries display name.
data.unitstringUnit label for tooltips.
data.digitsnumberDecimal places for tooltip values.
data.colorstringBase color for marks/links.
data.rangenumber | [number, number] | { auto?: boolean; default?: [number, number] }Value range; number sets symmetric ±range.
data.instantaneous{ using?: string | string[]; zoom?: number }Cursor sampling config.
chart'lines' | ... | { marks?: any[]; links?: any[] }Preset string or custom chart object.
chart.marksMark[]Visual marks per sample (circle, box, text, etc.).
chart.linksLink[]Connections between samples (line, area, etc.).
tooltipboolean | { label?: string; format?: () => string }Enable/disable tooltip and override label or formatter.
yAxis'left' | 'right' | { side?: 'left' | 'right'; label?: string }Position or label the per-series Y-axis. Not implemented yet.
trackstringTarget track name.

Chart Presets

PresetDescription
'lines'Line chart.
'lines:filled'Line chart with filled area below.
'steps-start'Step chart (step before point).
'steps-start:filled'Step chart filled (step before point).
'steps'Step chart (step at midpoint).
'steps:filled'Step chart filled (step at midpoint).
'steps-end'Step chart (step after point).
'steps-end:filled'Step chart filled (step after point).
'points'Scatter plot (circles only).
'linespoints'Line chart with circles.
'linespoints:filled'Line chart with circles and filled area.
'stepspoints-start'Step chart with circles (step before point).
'stepspoints-start:filled'Step chart with circles and fill (step before point).
'stepspoints'Step chart with circles (step at midpoint).
'stepspoints:filled'Step chart with circles and fill (step at midpoint).
'stepspoints-end'Step chart with circles (step after point).
'stepspoints-end:filled'Step chart with circles and fill (step after point).
'impulses'Vertical lines from baseline to value.
'impulsespoints'Vertical lines with circles at endpoints.
drawusingDescriptionStyle
'line'Single valueLine connecting pointsStroke
'curve'Single valueMonotone cubic lineStroke
'step'Single valueStep at midpointStroke
'step-start'Single valueStep before pointStroke
'step-end'Single valueStep after pointStroke
'area'Two values [min, max]Filled area between valuesStroke + Fill
'curve-area'Two values [min, max]Monotone cubic areaStroke + Fill
'step-area'Two values [min, max]Step area (midpoint)Stroke + Fill
'step-area-start'Two values [min, max]Step area (before point)Stroke + Fill
'step-area-end'Two values [min, max]Step area (after point)Stroke + Fill

Marks

drawusingDescriptionStyle
'circle'Single valueCircle at pointStroke + Fill + Size + Angle + Offset
'triangle'Single valueTriangle at pointStroke + Fill + Size + Angle + Offset
'square'Single valueSquare at pointStroke + Fill + Size + Angle + Offset
'cross'Single valueCross markStroke + Size + Angle + Offset
'plus'Single valuePlus markStroke + Size + Angle + Offset
'minus'Single valueHorizontal line markStroke + Angle + Offset
'line'Two values [start, end]Line segment between pointsStroke + Size + Offset
'section'Two values [start, end]Thick section between pointsStroke + Size + Offset
'box'Two values [min, max]Box spanning value rangeStroke + Fill + Size + Box + Offset
'text'Single valueText labelText + Size + Angle + Offset
'icon'Single valueIcon labelIcon + Size + Angle + Offset

Style options

Stroke

KeyTypeDescription
lineWidth?numberLine thickness in pixels.
lineColor?stringStroke color (CSS string).
lineDashArray?number[]Dash pattern (e.g., [5,3]).
lineDashOffset?numberDash offset in pixels.

Fill

KeyTypeDescription
fillColor?stringFill color (CSS string).
fillOpacity?numberOpacity 0..1.

Size

KeyTypeDescription
size?numberPixel size (meaning depends on primitive).

Angle

KeyTypeDescription
angle?numberRotation in radians.

Offset

KeyTypeDescription
offset?[number, number]Pixel offset [x, y].

Box (for 'box')

KeyTypeDescription
padding?number | [number, number?, number?, number?]Interior padding.
radius?numberCorner radius in pixels.

Text (for 'text')

KeyTypeDescription
text?stringText content.
fontFamily?stringFont family.
fontWeight?stringFont weight.
textAlign?'start' | 'center' | 'end' | 'left' | 'right'Horizontal alignment.
textBaseline?'top' | 'middle' | 'bottom' | 'hanging' | 'alphabetic' | 'ideographic'Vertical alignment.
textColor?stringText color.
textOpacity?numberOpacity 0..1.
textOutline?booleanEnable outline.
textOutlineColor?stringOutline color.
textOutlineWidth?numberOutline width in pixels.

Icon (for 'icon')

KeyTypeDescription
icon?stringIcon glyph.
iconFontFamily?stringIcon font family.
iconFontWeight?stringIcon font weight.
iconAlign?'start' | 'center' | 'end' | 'left' | 'right'Horizontal alignment.
iconBaseline?'top' | 'middle' | 'bottom' | 'hanging' | 'alphabetic' | 'ideographic'Vertical alignment.
iconColor?stringIcon color.
iconOpacity?numberOpacity 0..1.
iconOutline?booleanEnable outline.
iconOutlineColor?stringOutline color.
iconOutlineWidth?numberOutline width in pixels.

Tracks

TypeScript
tracks: {
  main: {
    height?: number,
    symmetric?: boolean,
    timeAxis?: boolean | {
      labels?: { color?: string; fontSize?: string },
      relative?: boolean,
      timeFormat?: (info) => string,
    },
  },
}
  • height — Fixed height in pixels (leave undefined for auto).
  • symmetric — Mirror positive/negative space.
  • timeAxis — Show time axis (true, false, or config object).

Selection

Enable range selection overlay:

TypeScript
selection: true

Configure:

TypeScript
selection: {
  resizable: true,
  color: '#3b82f6',
  invert: false,
  range: [start, end],
}

The setSelection([start, end]) and clearSelection() methods control selection at runtime. Selection changes emit rangechanging and rangechanged events.

See Also