Data model
Points, series, candles, and how LiveCharts consumes them
Single series
The default mode takes a history array and the latest scalar:
type LiveChartPoint = {
time: number; // unix seconds
value: number;
};
<LiveChart data={points} value={latest} />| Prop | Role |
|---|---|
data | Ordered history of { time, value } |
value | Latest reading (usually equals data.at(-1).value) |
window | Visible time horizon in seconds (default 30) |
Points outside the current window are still useful for scrubbing/history if you keep them; the engine trims visually to the window while you control how much history you store.
Multi-series
Pass series to draw overlapping lines. When series is non-empty it overrides data / value / color for drawing (you can still pass stub data/value to satisfy required props):
<LiveChart
data={[]}
value={0}
series={[
{ id: "yes", label: "Yes", color: "#22c55e", data: yesData, value: yesValue },
{ id: "no", label: "No", color: "#ef4444", data: noData, value: noValue },
]}
/>type LiveChartSeries = {
id: string;
data: LiveChartPoint[];
value: number;
color: string;
label?: string;
};Toggle chips appear automatically when there is more than one series. The last visible series cannot be hidden. See Multi-series.
Candlesticks
OHLC candles use a separate shape:
type CandlePoint = {
time: number; // candle open time (unix seconds)
open: number;
high: number;
low: number;
close: number;
};<LiveChart
data={ticks}
value={lastTick}
mode="candle"
candles={closedCandles}
liveCandle={formingCandle}
candleWidth={60}
onModeChange={setMode}
/>| Prop | Role |
|---|---|
mode | "line" | "candle" — built-in morph toggle when candle data is present |
candles | Closed / historical candles |
liveCandle | In-progress candle (wicks grow as ticks arrive) |
candleWidth | Bucket width in seconds |
Prefer aggregateCandles from livecharts/data instead of hand-rolling OHLC buckets.
Reference & orderbook shapes
type ReferenceLine = { value: number; label?: string };
type OrderbookData = {
bids: [price: number, size: number][];
asks: [price: number, size: number][];
};Documented in Reference line and Orderbook.
Time units
Everywhere in the public API, time is unix seconds (Date.now() / 1000). Passing milliseconds will stretch the window by 1000× and look broken.