Skip to content

ChartBuffer

Defined in: utils/ChartBuffer.ts:13

Column-oriented ring buffer for real-time chart display.

Stores time-series data as Float64Arrays keyed by column name, matching the ChartDataMap shape expected by uPlot. Supports efficient append and left-trim operations.

Used as a DuckDB bypass: during live streaming, data flows directly from WebSocket → ChartBuffer → uPlot.setData().

new ChartBuffer(columns, capacity): ChartBuffer

Defined in: utils/ChartBuffer.ts:23

string[]

Column names (must include “t” as the time axis).

number

Maximum number of points before oldest are dropped.

ChartBuffer

get capacity(): number

Defined in: utils/ChartBuffer.ts:39

number


get columns(): readonly string[]

Defined in: utils/ChartBuffer.ts:43

readonly string[]


get earliestT(): number

Defined in: utils/ChartBuffer.ts:111

The earliest time value, or Infinity if empty.

number


get latestT(): number

Defined in: utils/ChartBuffer.ts:105

The latest time value, or -Infinity if empty.

number


get length(): number

Defined in: utils/ChartBuffer.ts:35

number

clear(): void

Defined in: utils/ChartBuffer.ts:100

Clear all data.

void


getWindow(tMin, tMax): ChartDataMap

Defined in: utils/ChartBuffer.ts:88

Get a windowed view of data for a specific time range. Returns subarray views (zero-copy) for points where tMin <= t <= tMax.

number

number

ChartDataMap


push(values): void

Defined in: utils/ChartBuffer.ts:51

Append a single row of values.

Record<string, number>

Object with a value for each column name.

void


pushMany(rows): void

Defined in: utils/ChartBuffer.ts:66

Append multiple rows at once.

Record<string, number>[]

Array of value objects, one per row.

void


toChartData(): ChartDataMap

Defined in: utils/ChartBuffer.ts:76

Get a snapshot of the current data as ChartDataMap. Returns subarray views (zero-copy) into the internal buffers.

ChartDataMap