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().
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new ChartBuffer(
columns,capacity):ChartBuffer
Defined in: utils/ChartBuffer.ts:23
Parameters
Section titled “Parameters”columns
Section titled “columns”string[]
Column names (must include “t” as the time axis).
capacity
Section titled “capacity”number
Maximum number of points before oldest are dropped.
Returns
Section titled “Returns”ChartBuffer
Accessors
Section titled “Accessors”capacity
Section titled “capacity”Get Signature
Section titled “Get Signature”get capacity():
number
Defined in: utils/ChartBuffer.ts:39
Returns
Section titled “Returns”number
columns
Section titled “columns”Get Signature
Section titled “Get Signature”get columns(): readonly
string[]
Defined in: utils/ChartBuffer.ts:43
Returns
Section titled “Returns”readonly string[]
earliestT
Section titled “earliestT”Get Signature
Section titled “Get Signature”get earliestT():
number
Defined in: utils/ChartBuffer.ts:111
The earliest time value, or Infinity if empty.
Returns
Section titled “Returns”number
latestT
Section titled “latestT”Get Signature
Section titled “Get Signature”get latestT():
number
Defined in: utils/ChartBuffer.ts:105
The latest time value, or -Infinity if empty.
Returns
Section titled “Returns”number
length
Section titled “length”Get Signature
Section titled “Get Signature”get length():
number
Defined in: utils/ChartBuffer.ts:35
Returns
Section titled “Returns”number
Methods
Section titled “Methods”clear()
Section titled “clear()”clear():
void
Defined in: utils/ChartBuffer.ts:100
Clear all data.
Returns
Section titled “Returns”void
getWindow()
Section titled “getWindow()”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.
Parameters
Section titled “Parameters”number
number
Returns
Section titled “Returns”push()
Section titled “push()”push(
values):void
Defined in: utils/ChartBuffer.ts:51
Append a single row of values.
Parameters
Section titled “Parameters”values
Section titled “values”Record<string, number>
Object with a value for each column name.
Returns
Section titled “Returns”void
pushMany()
Section titled “pushMany()”pushMany(
rows):void
Defined in: utils/ChartBuffer.ts:66
Append multiple rows at once.
Parameters
Section titled “Parameters”Record<string, number>[]
Array of value objects, one per row.
Returns
Section titled “Returns”void
toChartData()
Section titled “toChartData()”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.