Function: createChart()
ts
function createChart(el, figure?, options?): Chart;Create a chart in el (plan §7.2). A chart already in el is destroyed first. The chart draws on the next microtask; await chart.ready (or any update call) to know when the frame is on screen.
Parameters
| Parameter | Type |
|---|---|
el | HTMLElement |
figure | FigureInput |
options | ChartOptions |
Returns
Example
ts
const chart = createChart(el, { data: [{ x: [1, 2, 3], y: [4, 1, 7], mode: 'markers' }] });
await chart.restyle({ 'marker.color': 'crimson' });