Documentation menu

Class

Series

A series of a FerroChart.

Properties

id

readonly id: number;

Id of the series, unique within its chart: handles of the same series (e.g. from a click event) have the same id.

kind

readonly kind: SeriesKind | 'volume' | 'custom' | 'kagi' | 'pointFigure';

The kind of the series: 'volume' for volume series, 'custom' for custom series, 'kagi'/'pointFigure' for those transforms (Renko and range bars are 'candlestick' or 'ohlc').

pane

readonly pane: number;

Id of the pane the series is on.

Methods

appendBars

appendBars(bars: OhlcData): void;

Adds candles (time, high and low are used) to a TPO series. Bars in the last session update it (a live candle sent again widens its period); bars outside the sessions are skipped.

appendDepth

appendDepth(snapshot: DepthSnapshot): void;

Adds an order book snapshot to a depth heatmap: within a column each level keeps its largest size.

appendTrades

appendTrades(trades: TradeData): void;

Adds trades to a footprint or a trade heatmap. Trades in the last column update it; later ones open new columns.

append

append(data: OhlcData | ValueData | OhlcRow[] | ValueRow[]): void;

Adds bars or points after the last one (a batch from a feed), in any form setData takes. Times must come after the last point, and the volume column must be present exactly when the series has one. Throws, leaving the data unchanged, otherwise. For a single live bar, update.

applyOptions

applyOptions(options: SeriesOptions): void;

Changes some options; keys left out keep their value.

createPriceLine

createPriceLine(options: PriceLineOptions): PriceLine;

Adds a horizontal line at a price of this series.

dataAt

dataAt(index: number): BarValues | {
    value: number;
} | null;

Values at logical index index: { open, high, low, close, volume } for OHLC series, { value } for the others; null for no data or a gap.

markers

markers(): Required<Marker>[];

The markers, sorted by time.

options

options(): Required<SeriesOptions>;

Current options.

prepend

prepend(data: OhlcData | ValueData | OhlcRow[] | ValueRow[]): void;

Inserts older bars or points before the first one (loading history, typically on needMoreHistory), in any form setData takes. Existing bars keep their logical indices (the new ones get negative indices), so the view does not move. Times must come before the first point; volume as for append. Throws, leaving the data unchanged, otherwise.

remove

remove(): void;

Removes the series (an OHLC series also removes its volume series).

setData

setData(data: OhlcData | ValueData | OhlcRow[] | ValueRow[]): void;

Replaces all data: OHLC columns for candlestick, OHLC and Heikin-Ashi series, { time, value, color? } for line, area, baseline, histogram and points series. Typed arrays are copied in one memcpy per column; Float64Array times are converted to integers. An array of rows ([{ time, open, high, low, close, volume? }] or [{ time, value, color? }], time in UTC ms or a Date) is also accepted; it is converted to columns first, so columns stay faster for large data.

setMarkers

setMarkers(markers: Marker[]): void;

Replaces the markers of this series.

update

update(bar: Bar | ValuePoint): void;

Updates the last bar or point (same time) or appends one (later time): { time, open, high, low, close, volume? } or { time, value }.

Like every object of the API, a Series holds WebAssembly memory. Objects returned by the chart are freed with it; free() (or using) releases one earlier.