Skip to content

charton API


charton API / @chart-on/ui / templates / indicatorTemplates

Function: indicatorTemplates() ​

indicatorTemplates(options?): (context) => { el: HTMLElement; destroy: void; } | null

Defined in: ui/src/templates.ts:162

Templates in the indicator settings panel, as its headerControl: the same Template menu as drawingTemplates, saving the indicator's inputs and plot styles as 'indicator' templates of its id. A saved name applies live, so Ok keeps it as one undo step and Cancel puts the indicator back. With defaults, the menu also has Save as default and Reset default.

Parameters ​

options? ​

IndicatorTemplateMenuOptions = {}

Returns ​

(context) => { el: HTMLElement; destroy: void; } | null

Example ​

ts
import { createChartShell } from '@chart-on/ui';
import { indicatorDefaults, indicatorTemplates } from '@chart-on/ui/templates';

const defaults = indicatorDefaults();
createChartShell(el, {
  indicatorSettings: { headerControl: indicatorTemplates({ defaults }) },
  indicatorPicker: { initialState: defaults.initialState },
});