Skip to content

charton API


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

Function: createNumericChart() ​

createNumericChart(container, options?): NumericChart

Defined in: packages/core/src/numeric/chart.ts:1257

Create a chart whose horizontal axis is a number (a price, maturity or strike) instead of time. Throws a ChartError (webgl2-unavailable) without WebGL2, leaving container untouched.

Parameters ​

container ​

HTMLElement

options? ​

NumericChartOptionsPatch

Returns ​

NumericChart

Example ​

ts
const chart = createNumericChart(el, { priceScale: { format: { type: 'percent', precision: 2 } } });
chart.addLine({ title: 'Yield' }).setData([
  { x: 0.25, value: 5.41 }, // maturity in years, yield in percent
  { x: 10, value: 4.31 },
]);