Core concepts
Data and time
Data shapes for each series, time rules, streaming, typed columns, and diagnostics.
Data shapes
Types
type time = number | business_day | string;
// candlestick, bar
interface ohlc_data {
time: time; open: number; high: number; low: number; close: number;
color?: string; wick_color?: string; border_color?: string;
}
// line, area, histogram, baseline
interface single_value_data { time: time; value: number; color?: string }
// a gap: a time slot with no value
interface whitespace_data { time: time }Per-point color fields override the series color for that bar. A row with only time is whitespace: it holds a slot on the time scale and draws nothing.
Time rules
- Numeric times are whole UTC seconds, between years 0000 and 9999.
- Aeris never converts timestamps for you. A batch that looks like milliseconds, microseconds, or nanoseconds is rejected with a hint naming the likely unit.
setDatabatches are atomic: one invalid time rejects the whole batch. An invalid singleupdateleaves existing data unchanged.- Rows are sorted by time; duplicate times keep the last row.
Diagnostics
try {
series.setData(rows);
} catch (error) {
console.warn(series.last_ingestion_diagnostics());
}Streaming
update(point) appends a new bar, or replaces the last bar when the time matches. pop() removes points from the end. To cap memory on long-running feeds, set the series option max_points; by default history is unbounded.
Bounded live series
const line = chart.addSeries("line", { max_points: 50_000 });
line.update({ time: 1735689660, value: 105.25 });Typed columns
For large histories, set_data_typed(columns) and update_typed(columns) accept column arrays instead of row objects, which avoids building one object per bar. set_ring_source binds a shared-memory ring buffer for the highest-rate feeds.
Reading data back
| Method | Returns |
|---|---|
data() | The aligned rows currently held by the series. |
data_by_index(index) | The row at a logical index. |
bars_in_logical_range(range) | Counts of bars before, inside, and after a logical range. |
last_value_data() | The last value and its color, as drawn on the price axis. |
subscribe_data_changed(cb) | Notifies you when the series data changes. |