Skip to content

charton API


charton API / @chart-on/ui / index / IndicatorPickerOptions

Interface: IndicatorPickerOptions ​

Defined in: ui/src/indicator-picker.ts:52

Options of createIndicatorPicker, and of the shell's indicatorPicker option.

Properties ​

actions? ​

optional actions?: IndicatorPickerAction[]

Defined in: ui/src/indicator-picker.ts:65

Extra buttons on definition rows.


addOptions? ​

optional addOptions?: Omit<IndicatorAddOptions, "placement">

Defined in: ui/src/indicator-picker.ts:97

Options for every indicator the picker adds, e.g. { renderer: 'canvas' }; the row decides placement.


container? ​

optional container?: HTMLElement

Defined in: ui/src/indicator-picker.ts:54

Element the dialog covers while open. Default the shell around the chart, else the chart's root.


debounce? ​

optional debounce?: number

Defined in: ui/src/indicator-picker.ts:109

Wait this long after the last keystroke before filtering, in ms. Default 80.


favorites? ​

optional favorites?: FavoritesList | null

Defined in: ui/src/indicator-picker.ts:90

Keep the favourites in this list instead of storage, e.g. the shell's favorites.of('indicator'), which the shell passes when it has the favorites part. Favourites storage held are moved into it once, while it is empty. Recents stay in storage.


groups? ​

optional groups?: IndicatorPickerGroup[]

Defined in: ui/src/indicator-picker.ts:67

Host sections listed as tabs after the categories, e.g. "My indicators".


openOnSlash? ​

optional openOnSlash?: false | HTMLElement

Defined in: ui/src/indicator-picker.ts:115

Typing / while this element has focus opens the picker. Default the chart's root; false turns it off. The shortcut is the 'indicator-picker' action on chart.actions, so it can be rebound.


placement? ​

optional placement?: IndicatorPlacement

Defined in: ui/src/indicator-picker.ts:75

Placement of placement: 'either' definitions until the user switches a row. Default 'overlay'.


settings? ​

optional settings?: SettingsAdapter

Defined in: ui/src/indicator-picker.ts:83

Preference store for recents and favourites, under key indicator-picker, e.g. the settings of createLocalStorageAdapter or an app's own store. Used when storage is not given.


sourceSwitch? ​

optional sourceSwitch?: boolean

Defined in: ui/src/indicator-picker.ts:73

Show a Built-in / Custom switch above the categories: Built-in lists the definitions in none of the groups, Custom those in one, with the group tabs. The picker opens on Built-in. Default false: every definition in All.


storage? ​

optional storage?: IndicatorPickerStorage | null

Defined in: ui/src/indicator-picker.ts:77

Where recents and favourites are kept; null keeps them for this visit only. Default settings, else localStorage.


storageKey? ​

optional storageKey?: string

Defined in: ui/src/indicator-picker.ts:95

localStorage key of the default storage. Default 'charton:indicator-picker'. Charts sharing a key share their recents and favourites.

Methods ​

filter()? ​

optional filter(def): boolean

Defined in: ui/src/indicator-picker.ts:56

Return false to hide a registered definition from the picker.

Parameters ​

def ​

IndicatorDef

Returns ​

boolean


initialState()? ​

optional initialState(def): Partial<Pick<IndicatorState, "inputs" | "plotStyles">> | Promise<Partial<Pick<IndicatorState, "inputs" | "plotStyles">> | null> | null

Defined in: ui/src/indicator-picker.ts:107

The inputs and plot styles an indicator added from the picker starts with, or null for its definition's defaults, e.g. a saved default from indicatorDefaults() of @chart-on/ui/templates. The picker waits for a promise, and a rejected one adds with the definition's defaults. Inputs go to add, which refuses invalid ones like any add. Plot styles apply right after it, as their own undo step; ones the indicator refuses are skipped. Indicators added from code are not affected.

Parameters ​

def ​

IndicatorDef

Returns ​

Partial<Pick<IndicatorState, "inputs" | "plotStyles">> | Promise<Partial<Pick<IndicatorState, "inputs" | "plotStyles">> | null> | null


onAdd()? ​

optional onAdd(indicator): void

Defined in: ui/src/indicator-picker.ts:58

Called after the picker added an indicator.

Parameters ​

indicator ​

Indicator

Returns ​

void


onOpenChange()? ​

optional onOpenChange(open): void

Defined in: ui/src/indicator-picker.ts:117

Called when the dialog opens or closes, e.g. to refresh a toolbar button's pressed state.

Parameters ​

open ​

boolean

Returns ​

void


onSearchAll()? ​

optional onSearchAll(query): void

Defined in: ui/src/indicator-picker.ts:123

Hand the query to a wider search, e.g. (query) => palette.open(query). When set, a footer button under the results offers it while the search box has text; the picker closes first. The shell sets it to its command palette.

Parameters ​

query ​

string

Returns ​

void


onSettings()? ​

optional onSettings(indicator): void

Defined in: ui/src/indicator-picker.ts:63

Open the settings of an indicator on the chart. When set, rows of indicators on the chart get a settings button.

Parameters ​

indicator ​

Indicator

Returns ​

void