Components/TimeseriesChart

TimeseriesChart

Time-series lines and stacked bars: clustered markers, threshold lines, range brushing, full tooltips.

VerifiedSince 0.1.0

TimeseriesChart

Basic Usage

data is an array of series; each series' data holds time-ordered [timestamp_ms, value] tuples. color is optional — series fall onto the categorical palette by position, and positions are stable, so hiding one series never recolors the rest. Hovering opens the tooltip: rows sort by value descending, duplicate names dedupe, and values resolve by binary-searching the nearest sample.

Two-series lines

Lines + axis formatting

xAxisTickFormat / tooltipValueFormat customize tick and value text.

Loading demo...

Markers & Thresholds

markers draw vertical dashed lines on the time axis; markers that crowd together cluster into one line based on the visible span, the label becomes "N changes" (clusterLabel overrides the wording), and hovering the line lists each marker's label and description. thresholds draw horizontal lines on the value axis, and the y domain extends automatically to cover them.

Deploy markers + SLO line

Markers + Thresholds

The last two markers sit close together and cluster.

Loading demo...

Gradient & Incomplete Data

gradient adds a vertical fill under each line (series color at 40% → transparent). incomplete declares data outside [before, after] as incomplete: edge segments render dashed and overlap the solid segment by one sample so the line stays connected.

Gradient + dashed edges

Gradient + Incomplete

The first and last three hours are incomplete periods.

Loading demo...

Stacked Bars

With type="bar" every series stacks automatically (kumo's stack: 'total'), and the y domain covers each timestamp's stacked total.

Daily stacks

Stacked bars

Three series share one bar per day.

Loading demo...

Time Range Selection

Attaching a time-range-change listener enables horizontal brushing: drag on the plot to draw a selection; releasing emits (from, to) in milliseconds and clears the selection. Drags under 3px count as clicks and do nothing.

Drag to select

Brush selection

The readout below shows the selected range.

Loading demo...

Legend Interplay

v-model:hidden-series two-way binds the hidden series names: hidden series neither render nor appear in tooltips. highlighted-series emphasizes one series and dims the rest to 30% opacity. Combine both with TxChartLegendItem for a clickable, hover-highlighting legend.

Click to hide + hover to highlight

Legend interplay

Click legend items to toggle; hover to highlight.

Loading demo...

Loading Skeleton

loading swaps the chart for a harmonic-wave skeleton; the line and bar variants share one silhouette, and the shimmer respects prefers-reduced-motion.

Skeleton loop

Loading skeleton

Loading toggles on a loop, alternating the line and bar variants.

Loading demo...

API

TimeseriesChart Props

PropTypeDefaultDescription
dataTimeseriesData[]{ name, data: [ts, value][], color? }; missing color falls onto the categorical palette by position.
type'line' | 'bar''line'Bars stack automatically.
markersTimeseriesMarker[]{ timestamp, label?, description?, color?, lineStyle? }.
thresholdsTimeseriesThreshold[]{ value, label?, color }; the y domain extends to cover them.
xAxisName / yAxisNamestringAxis names.
xAxisTickCount / yAxisTickCountnumber5Suggested tick counts.
xAxisTickFormat / yAxisTickFormat(v: number) => stringTick formatters.
tooltipValueFormat(v: number) => stringraw valueTooltip value formatter.
tooltipMode'all' | 'single''all'single shows only the series closest to the cursor's y value.
tooltipMaxItemsnumber10Overflow folds into "+N more".
tooltipFollowCursor'both' | 'x''both'x pins the vertical position to avoid jitter.
incomplete{ before?, after? }Incomplete periods (line type only).
gradientbooleanfalseGradient fill under lines.
loadingbooleanfalseSkeleton state.
highlightedSeriesstring | nullEmphasized series; the rest dim to 30% opacity.
heightnumber350Pixel height.
widthnumbermeasuredExplicit width (SSR/tests).
ariaDescriptionstringAccessible description (svg role="img").
clusterLabel(n: number) => stringn => `${n} changes`Cluster label wording.
timestampFormat(ts: number) => stringcompact localeTooltip timestamp format.

TimeseriesChart Events

EventPayloadDescription
time-range-change(from: number, to: number)Brush finished. Attaching it enables brushing.
update:hiddenSeries(names: string[])v-model:hidden-series write-back.

Differences from kumo

  • enableLegendSelection + imperative echarts actions → declarative v-model:hidden-series; highlighting via highlighted-series.
  • tooltipBoundary (clipping-ancestors collision) is simplified to container clamping + viewport flipping.
  • No 30% out-of-brush dimming during the drag (kumo's transient outOfBrush) — only the selection rectangle renders.
  • Keep each series under ~5k points: SVG rendering degrades in the tens of thousands.