Range

Control the visible time window, axis position, and zoom behaviour.

TempisTimelineRangeOptions

PropertyTypeDefaultDescription
fixedbooleanfalseLock the range so users cannot pan or zoom.
position"top" | "bottom" | "both" | "none""bottom"Where the time axis is rendered.
startstring | number | DateInitial start of the visible range.
endstring | number | DateInitial end of the visible range.
minstring | number | DateEarliest date the user can scroll to.
maxstring | number | DateLatest date the user can scroll to.
zoomTempisTimelineRangeZoomOptionsZoom configuration (see below).
minorUnitTempisTimelineRangeUnitOptionsMinor tick label font and format overrides.
majorUnitTempisTimelineRangeUnitOptionsMajor tick label font and format overrides.
If start and end are omitted, the timeline automatically fits to show all items.

Zoom Options

PropertyTypeDefaultDescription
enabledbooleantrueEnable or disable zooming.
minnumberMinimum visible range in milliseconds.
maxnumberMaximum visible range in milliseconds.
wheelSensitivitynumber1.0Mouse wheel zoom speed multiplier.
pinchSensitivitynumber1.0Touch pinch zoom speed multiplier.
Setting zoom.min prevents users from zooming in too far (e.g. to millisecond level), while zoom.max prevents zooming out beyond a useful range.

Example

const timeline = new TempisTimeline('#canvas', {
  responsive: true,
  items: [
    { id: 1, label: 'Item 1', start: '2026-01-01', end: '2026-03-01' },
    { id: 2, label: 'Item 2', start: '2026-03-01', end: '2026-06-01' },
  ],
  range: {
    start: '2026-01-01',
    end: '2026-06-30',
    min: '2025-01-01',
    max: '2027-01-01',
    position: 'bottom',
    zoom: {
      enabled: true,
      min: 1000 * 60 * 60 * 24 * 7,   // 1 week minimum
      max: 1000 * 60 * 60 * 24 * 365,  // 1 year maximum
      wheelSensitivity: 1.2
    }
  }
});