Skip to content

charton API


charton API / @chart-on/core / index / createChart

Function: createChart() ​

createChart(container, options?): Chart

Defined in: packages/core/src/chart.ts:7071

Create a chart that fills container. options is merged over defaultChartOptions; change it later with chart.applyOptions. Needs WebGL2 (see isWebGL2Supported).

Parameters ​

container ​

HTMLElement

options? ​

ChartOptionsPatch

Returns ​

Chart

Example ​

ts
const chart = createChart(el, { barSpacing: 10 });
const candles = chart.addCandles({ title: 'Price' });
candles.setData(bars); // { time (unix seconds), open, high, low, close, volume? }
chart.on('history:request', ({ before }) => loadOlder(before));