Live Charts

Pro

6 real-time variants: live spline, live stock (OHLC), dynamic data source, click-to-add point, live sorting and a continuous live stream. Every timer is cleared while its tab is hidden, and a variant that generates its own data states the gap on the way back. Pure SVG.

</>sv-live-spline-chart chartrealtimestreaming
import { SvLiveSplineChartComponent } from '@styloviz-pro/charts';

Demo & usage

Basic usage

Pro

Usage example — open the gallery for the full interactive demo.

Pro

An interactive demo for this component lives in the gallery.

Open live demo

More examples

Push readings from your own feed

Pro

When to use

  • Streaming real-time metrics that update continuously (throughput, prices, sensors).
  • You want a sliding window that animates as new points arrive.
  • For static historical trends, the standard Line Chart is lighter.

Async states

  • loading
  • empty
  • error
  • retry

Inputs

NameTypeDefaultDescription
loadingbooleanfalseTrue while the series are being fetched.
errorSvDataError | string | nullnullLoad failure. Use `toSvDataError()` from `@styloviz/core` to normalize an `HttpErrorResponse`.
emptyMessagestring'No data to plot'Copy for the empty state.
filteredbooleanfalseWhether a filter, not an absence of data, is why the chart is empty.
titlestring'Live Spline Chart'Chart title.
seriesLiveSplineSeries[][ { label: 'Series A', color: PALETTE[0…The series to draw — names, colours and fills. Their VALUES are generated by the chart (a bounded random walk); this variant takes no host data. For a host-fed stream use `sv-live-stream-chart-pro` and its `push()`.
optionsLiveSplineChartOptions{}Advanced options (window size, tick interval, axes…).
ariaLabelstring''Accessible-name override for the chart image.

Outputs

EventPayload typeDescription
retryvoidThe host should re-run the failed load.

<sv-live-update-chart>

Also in this family — SvLiveUpdateChartComponent from @styloviz/charts.

Async states

  • loading
  • empty
  • error
  • retry

Inputs

NameTypeDefaultDescription
loadingbooleanfalseTrue while the series are being fetched.
errorSvDataError | string | nullnullLoad failure. Use `toSvDataError()` from `@styloviz/core` to normalize an `HttpErrorResponse`.
emptyMessagestring'No data to plot'Copy for the empty state.
filteredbooleanfalseWhether a filter, not an absence of data, is why the chart is empty.
titlestring'Revenue & Expenses'Chart title, rendered in the header and used in the default accessible name.
ariaLabelstring''Accessible-name override for the chart image.
categoriesstring[]CATEGORIESX-axis category labels; each dataset's `data[i]` is plotted against `categories[i]`.
sourcesLiveUpdateSource[][]Switchable data sets, one toggle button each; the bars animate between them and the Y-axis is fixed to the max across all sources. The first source is active on init; an empty array shows the empty state.
optionsLiveUpdateChartOptions{}Height, bar transition duration, corner radius, and value-label/grid/legend toggles — see `LiveUpdateChartOptions`.

Outputs

EventPayload typeDescription
retryvoidThe host should re-run the failed load.

<sv-live-update-chart-pro>

Also in this family — SvLiveUpdateChartProComponent from @styloviz-pro/charts.

Async states

  • loading
  • empty
  • error
  • retry

Inputs

NameTypeDefaultDescription
loadingbooleanfalseTrue while the series are being fetched.
errorSvDataError | string | nullnullLoad failure. Use `toSvDataError()` from `@styloviz/core` to normalize an `HttpErrorResponse`.
emptyMessagestring'No data to plot'Copy for the empty state.
filteredbooleanfalseWhether a filter, not an absence of data, is why the chart is empty.
titlestring'Revenue & Expenses'Chart title, rendered in the header and used in the default accessible name.
ariaLabelstring''Accessible-name override for the chart image.
categoriesstring[]CATEGORIESX-axis category labels; each dataset's `data[i]` is plotted against `categories[i]`.
sourcesLiveUpdateSource[][]Switchable data sets, one toggle button each; the bars animate between them and the Y-axis is fixed to the max across all sources. The first source is active on init; an empty array shows the empty state.
optionsLiveUpdateChartOptions{}Height, bar transition duration, corner radius, and value-label/grid/legend toggles — see `LiveUpdateChartOptions`.

Outputs

EventPayload typeDescription
retryvoidThe host should re-run the failed load.

<sv-live-stream-chart>

Also in this family — SvLiveStreamChartComponent from @styloviz/charts.

Async states

  • loading
  • empty
  • error
  • retry
  • offline

Inputs

NameTypeDefaultDescription
loadingbooleanfalseTrue while the series are being fetched.
errorSvDataError | string | nullnullLoad failure. Use `toSvDataError()` from `@styloviz/core` to normalize an `HttpErrorResponse`.
emptyMessagestring'No data to plot'Copy for the empty state.
filteredbooleanfalseWhether a filter, not an absence of data, is why the chart is empty.
demoFeedbooleanfalseGenerate the stream's points internally, with `Math.random()`. For demos and screenshots only. This used to be the only behaviour, so a chart wired to a real feed drew invented numbers alongside the real ones.
connectionSvConnectionState'idle'State of the socket / `EventSource` behind `push()`. A stream that stops moving looks the same whether the source went quiet or the connection dropped, so the chart cannot infer this — only the host knows. `idle` renders nothing; anything else replaces the LIVE badge with the state.
reconnectablebooleanfalseOffer a Reconnect button while `connection` is `reconnecting` or `closed`. Off by default: most hosts retry on their own, and a second manual trigger opens a second socket.
titlestring'Live Data Stream'Chart title, rendered in the header and used in the default accessible name.
subtitlestring''Secondary line shown under the title; hidden when empty.
seriesLiveStreamSeries[][ { label: 'Sensor A', color: PALETTE[0…The streamed lines, one per entry — `label` for the legend and accessible name, optional `color` (falls back to the palette). `push()` values map to these by index; an empty array shows the empty state.
optionsLiveStreamChartOptions{}Height, visible window size, point interval, smoothing, grid/legend/area toggles and fixed Y range — see `LiveStreamChartOptions`.
ariaLabelstring''Accessible-name override for the chart image.

Outputs

EventPayload typeDescription
retryvoidThe host should re-run the failed load.
reconnectvoidThe user asked to re-open the feed.

<sv-live-stream-chart-pro>

Also in this family — SvLiveStreamChartProComponent from @styloviz-pro/charts.

Async states

  • loading
  • empty
  • error
  • retry
  • offline

Inputs

NameTypeDefaultDescription
loadingbooleanfalseTrue while the series are being fetched.
errorSvDataError | string | nullnullLoad failure. Use `toSvDataError()` from `@styloviz/core` to normalize an `HttpErrorResponse`.
emptyMessagestring'No data to plot'Copy for the empty state.
filteredbooleanfalseWhether a filter, not an absence of data, is why the chart is empty.
demoFeedbooleanfalseGenerate the stream's points internally, with `Math.random()`. For demos and screenshots only. This used to be the only behaviour, so a chart wired to a real feed drew invented numbers alongside the real ones.
connectionSvConnectionState'idle'State of the socket / `EventSource` behind `push()`. A stream that stops moving looks the same whether the source went quiet or the connection dropped, so the chart cannot infer this — only the host knows. `idle` renders nothing; anything else replaces the LIVE badge with the state.
reconnectablebooleanfalseOffer a Reconnect button while `connection` is `reconnecting` or `closed`. Off by default: most hosts retry on their own, and a second manual trigger opens a second socket.
titlestring'Live Data Stream'Chart title, rendered in the header and used in the default accessible name.
subtitlestring''Secondary line shown under the title; hidden when empty.
seriesLiveStreamSeries[][ { label: 'Sensor A', color: PALETTE[0…The streamed lines, one per entry — `label` for the legend and accessible name, optional `color` (falls back to the palette). `push()` values map to these by index; an empty array shows the empty state.
optionsLiveStreamChartOptions{}Height, visible window size, point interval, smoothing, grid/legend/area toggles and fixed Y range — see `LiveStreamChartOptions`.
ariaLabelstring''Accessible-name override for the chart image.

Outputs

EventPayload typeDescription
retryvoidThe host should re-run the failed load.
reconnectvoidThe user asked to re-open the feed.

<sv-live-stock-chart>

Also in this family — SvLiveStockChartComponent from @styloviz-pro/charts.

Async states

  • loading
  • empty
  • error
  • retry
  • offline

Inputs

NameTypeDefaultDescription
symbolstring'NASDAQ: TECH'Ticker symbol shown in the header and used in the default accessible name.
datareadonly OhlcCandle[][]The series to render. Left empty — the default — the chart generates its own random walk and ticks it on a timer, which is what makes it a usable demo widget with no wiring at all. Supply a series and it becomes a plain renderer instead: no generator, no timer, no live badge. There is no third mode where a random walk is appended to real candles, because a chart that disagrees with the response it was given is worse than either.
livebooleantrueWhether the chart may generate its own series when `data` is empty. True — the default — is what makes `<sv-live-stock-chart />` a working demo with no wiring. Set it false and the chart renders only what it is given, so an empty response shows the empty state instead of a random walk. A dashboard almost always wants false: a generated price is worse than no price, because it looks like an answer.
connectionSvConnectionState'idle'State of the socket / `EventSource` behind a host-fed `data`. A series that stops updating looks the same whether the market is quiet or the connection dropped, so the chart cannot infer this — only the host knows. `idle` renders nothing. Ignored in self-driving mode, which has no socket.
reconnectablebooleanfalseOffer a Reconnect button while `connection` is `reconnecting` or `closed`. Off by default: most hosts retry on their own, and a second manual trigger opens a second socket.
loadingbooleanfalseShow the loading placeholder instead of the plot.
errorSvDataError | string | nullnullRender an error state with a retry instead of the plot.
emptyMessagestring'No candles to plot'Message for the empty state.
filteredbooleanfalseSet when the empty state is the result of a filter, not of no data.
ariaLabelstring''Accessible-name override for the chart image.
optionsLiveStockChartOptions{}Tick interval, visible candle window, candle/volume pane heights, auto-start and demo seed price — see `LiveStockChartOptions`.

Outputs

EventPayload typeDescription
reconnectvoidThe user asked to re-open the feed.
retryvoidThe host should re-run the failed load.

<sv-click-add-point-chart>

Also in this family — SvClickAddPointChartComponent from @styloviz-pro/charts.

Async states

None — this component has nothing to load, so it has no loading, empty or error state to drive.

Inputs

NameTypeDefaultDescription
titlestring'Click to Add Data Points'Chart title, rendered in the header and used in the default accessible name.
ariaLabelstring''Accessible-name override for the chart image.
optionsClickAddChartOptions{}Height, max points before the plot auto-resets, grid toggle, point/line colors and area fill — see `ClickAddChartOptions`.

<sv-live-sort-chart>

Also in this family — SvLiveSortChartComponent from @styloviz-pro/charts.

Async states

None — this component has nothing to load, so it has no loading, empty or error state to drive.

Inputs

NameTypeDefaultDescription
titlestring'Live Data Sorting'Chart title, rendered in the header and used in the default accessible name.
ariaLabelstring''Accessible-name override for the chart image.
optionsLiveSortChartOptions{}Height, auto-sort interval (`sortInterval` in ms), grid/value-label toggles, bar corner radius and bar animation duration — see `LiveSortChartOptions`.

Wire it to your API

This component is headless about transport: it renders what you give it and reports what the user asks for. Nothing below requires @styloviz/data — drive it from whatever you already use.

Template

Pro

Bound to the names this component actually exposes.

Host class

Pro

Drive the three async inputs from your own fetch.

  • This component does not emit a query, so it renders what you give it. Fetch on your own trigger and bind `series`, `loading` and `error`.
  • Set `filtered` when a search or filter is active. It is the difference between "you have no orders" and "no orders match this filter" — telling a customer with 4,000 orders the first one reads as a bug.
  • Normalize failures with `toSvDataError()` from `@styloviz/core`. It derives `retryable` from the status, so a 404 does not get a "Try again" button that can only fail again.

Full walkthrough: Connecting to a backend.

Customization & theming

  • Streaming spline, OHLC and live-sort modes.
  • Every timer-driven variant (live stream in demo mode, live spline, live stock in demo mode, live sort) runs on `createLiveTicker` from `@styloviz/core`: the interval is cleared while its tab is hidden or the user has paused, and re-created when both allow it. The generated variants — spline, demo stock, demo stream — state the gap on the way back once it is long enough to be a hole in the data; live sort owns its data locally and has no feed gap to state.
  • The live stream's `push()` and every generator keep their window through `svAppendSample` in `@styloviz/core` (a stock chart given `data` draws the last `windowSize` candles of what the host sent, and the host owns that history). The helper is also there for a host's own feed: a bounded history with a stated retention window, and a policy for a sample that arrives late or twice — keep it in arrival order, refuse it as a retransmission, or insert it where its timestamp belongs. The live stream's `push()` is positional (its readings carry no timestamp), so it keeps arrival order; the demo stock generator refuses a candle not newer than the last.
  • The live stream and the live stock chart take `connection`, `reconnectable` and `(reconnect)` — the same streaming vocabulary as the AI activity log — and show the host's state in place of their own LIVE badge.
  • Configurable window size and tick interval.
  • Click-to-add data points.
  • Two variants — click-to-add and live-sort — build their own series from clicks or a timer, so they take no `loading` or `error` input: there is no fetch to be in flight. The streaming variants above take both.

Best practices

  • Do: Cap the visible window so the chart doesn't grow unbounded in memory.
  • Do: Push readings as they arrive rather than throttling them yourself. The live stream draws at most one point per slide (about 0.88 × `intervalMs`); pushes that land mid-slide are coalesced — the latest wins and is drawn when the slide ends — so a burst costs one extra render, not one per push, and the last reading of a burst is never lost — pressing Pause draws it at once rather than discarding it.
  • Do: Report your socket's state through `connection` (`open`, `reconnecting`, `closed`) on the host-fed variants — the live stream, and the live stock chart given `data`. A feed that dropped looks exactly like a quiet one, so only the host can say which; `reconnectable` adds a Reconnect button that emits `reconnect`.
  • Do: Leave the background pause alone. Every timer-driven variant clears its interval when its tab is hidden, and never starts one in a tab that opened in the background — not skipping ticks, which in a zone.js host still costs a change-detection pass each — and re-creates it when the tab comes back, which is the difference between a dashboard left open behind another window costing nothing and costing full price for hours. Browsers throttle a hidden tab's timers but do not stop them, and do nothing at all about the work each tick queues.
  • Don't: Do not resume a paused feed silently. A chart that picks up where it left off draws a continuous line across a stretch where nothing was sampled — the same claim as interpolating a missing reading, and harder to catch, because the result looks exactly like a chart that ran the whole time. A pause long enough to be a hole in the data is stated under the plot; a two-second tab switch is not, because announcing every one of those would train the reader to ignore the line that matters. The statement is made only when the chart's OWN generator was running and stopped: a host-fed stream, or a stock chart given `data`, kept receiving while hidden — a hidden live stream appends each push straight into its window — so it says nothing.
  • Tip: Surface the latest value as text for users who can't track motion.

Accessibility

  • A gap the chart's own generator left during a background pause is stated in text under the plot, not left to be inferred from the line. Motion is the one channel a live chart leans on hardest and the one a reader may not be watching, so a break in sampling has to be readable after the fact.
  • A dropped or reconnecting feed is announced politely (`role="status"`) when the host reports it through `connection`, and the Reconnect button is a real, labelled button.
  • The streaming SVG is `role="img"` with a description of the series (override via `ariaLabel`); play/pause and reset controls are labelled buttons.
  • Live spline and live stock surface the latest value as text — the legend reading and the ticker price. The live stream does not yet, and none of the live variants reduces its motion under `prefers-reduced-motion` yet.

Feedback on Live Charts

Spotted a gap in this page, or something that didn't work as described? Comments are GitHub Discussions in the public styloviz/community repo, so posting needs a GitHub account.

Loads giscus.app and GitHub — nothing is fetched until you click.