Skip to content

Series

Financial series

Candles, bars, lines, areas, histograms, baselines, and the advanced financial series.

Series kinds

Financial series kinds
KindDataUse it for
candlestickohlc_dataClassic OHLC candles.
barohlc_dataOHLC bars.
linesingle_value_dataClose prices, spreads, any single value.
areasingle_value_dataA line with a gradient fill.
histogramsingle_value_dataVolume and other per-bar columns.
baselinesingle_value_dataValues colored above and below a base value.
footprintfootprint_tradeBid and ask volume at every price. See Footprint and order flow.

Adding and styling a series

Series
const area = chart.addSeries("area", { title: "BTC" });
area.setData([
  { time: 1735689600, value: 94210 },
  { time: 1735693200, value: 94480 },
]);

area.applyOptions({ visible: true, last_value_visible: true });
area.set_type("line"); // switch kinds on the same data

chart.removeSeries(area);

Series handles also provide options, series_type, pane_index, move_to_pane, move_to_price_scale, price_formatter, price_to_coordinate, coordinate_to_price, and fit_viewport.

Advanced financial series

Advanced financial series kinds
KindRow shape
heatmap{ time, cells: [{ low, high, amount }] }
hlc_area{ time, high, low, close }
stacked_area{ time, values: number[] }
stacked_bars{ time, values: number[] }
grouped_bars{ time, values: number[] }
pretty_histogram{ time, value, color? }
whisker_box{ time, quartiles: [5 numbers], outliers? }
background_shade{ time, value }
Heatmap
const heatmap = chart.addSeries("heatmap", {
  cell_border_width: 1,
  cell_border_color: "rgba(255,255,255,.08)",
  cell_shader: (amount) => `rgba(80,0,255,${Math.min(1, amount / 100)})`,
});
heatmap.setData(heatmapRows);

Every stacked_area row needs the same number of layers. The old brushable_area kind is deprecated: use an ordinary area series with enable_brushable_area_interaction().