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?
optionalactions?:IndicatorPickerAction[]
Defined in: ui/src/indicator-picker.ts:65
Extra buttons on definition rows.
addOptions?
optionaladdOptions?: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?
optionalcontainer?: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?
optionaldebounce?:number
Defined in: ui/src/indicator-picker.ts:109
Wait this long after the last keystroke before filtering, in ms. Default 80.
favorites?
optionalfavorites?: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?
optionalgroups?:IndicatorPickerGroup[]
Defined in: ui/src/indicator-picker.ts:67
Host sections listed as tabs after the categories, e.g. "My indicators".
openOnSlash?
optionalopenOnSlash?: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?
optionalplacement?:IndicatorPlacement
Defined in: ui/src/indicator-picker.ts:75
Placement of placement: 'either' definitions until the user switches a row. Default 'overlay'.
settings?
optionalsettings?: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?
optionalsourceSwitch?: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?
optionalstorage?: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?
optionalstorageKey?: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()?
optionalfilter(def):boolean
Defined in: ui/src/indicator-picker.ts:56
Return false to hide a registered definition from the picker.
Parameters
def
Returns
boolean
initialState()?
optionalinitialState(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
Returns
Partial<Pick<IndicatorState, "inputs" | "plotStyles">> | Promise<Partial<Pick<IndicatorState, "inputs" | "plotStyles">> | null> | null
onAdd()?
optionalonAdd(indicator):void
Defined in: ui/src/indicator-picker.ts:58
Called after the picker added an indicator.
Parameters
indicator
Returns
void
onOpenChange()?
optionalonOpenChange(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()?
optionalonSearchAll(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()?
optionalonSettings(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
Returns
void