Skip to main content

API Reference

This page documents every public type exported from the @altrady/charts package. All signatures are taken directly from the source.


AltradyChartsOptions​

Passed to new AltradyCharts(options).

export interface AltradyChartsOptions {
// ---- Required ----

/** DOM element ID string or HTMLElement reference */
container: string | HTMLElement

/** Symbol to display on initial load */
symbol: SymbolInfo

/** Timeframe to display on initial load */
period: Period

/** Data loader created via createDataLoader(datafeed) */
dataLoader: DataLoader

// ---- Backend Indicators ----

/** Provider for server-calculated indicator data */
indicatorProvider?: IndicatorProvider

// ---- Storage ----

/** Adapter for saving/loading chart state */
storageAdapter?: StorageAdapter

/**
* Key used by storageAdapter.save/load.
* Defaults to symbol.ticker.
* Use a compound key for per-user or per-layout isolation.
*/
storageKey?: string

// ---- Initial State ----

/** Built-in klinecharts indicator names to show on the candle pane (e.g. ['MA', 'BOLL']) */
mainIndicators?: string[]

/** Built-in klinecharts indicator names to show in sub-panes (e.g. ['VOL', 'RSI']) */
subIndicators?: string[]

// ---- Customization ----

/** BCP-47 locale tag. Default: 'en-US' */
locale?: string

/** 'light' | 'dark' or a custom theme name. Default: 'light' */
theme?: 'light' | 'dark' | string

/** IANA timezone identifier. Default: 'Etc/UTC' */
timezone?: string

/** Watermark string (HTML allowed) or a DOM Node rendered on the canvas */
watermark?: string | Node

/** Fine-grained style overrides; merged with theme defaults */
styleOverrides?: DeepPartial<Styles>

/** Font of the time and price scales: tick labels, crosshair labels and
* last-value labels. `styleOverrides` wins where both set a path.
* e.g. { family: '-apple-system, BlinkMacSystemFont, "Trebuchet MS", Roboto, sans-serif', size: 12 } */
axisFont?: { family?: string; size?: number }

// ---- Script Execution ----

/** Provider for server-side script compilation and execution */
scriptProvider?: ScriptProvider

/** Called when a running script raises an alert. See docs/scripts.md */
onScriptAlert?: (alert: ScriptAlertEvent) => void

/** "Add alert" on a script indicator's legend: which indicator, its inputs
* and the market. The alert itself is the host's. See docs/scripts.md */
onAddIndicatorAlert?: (target: IndicatorAlertTarget) => void

/** Built-in slugs that offer "Add alert". Default: none. Update with
* `superchart.setAlertableBuiltins(slugs)`. */
alertableBuiltins?: readonly string[]

/** The flywheel: a radial quick-pick for drawing tools and drawing templates,
* opened with a hotkey. Opt-in; omitted or `false` mounts nothing and listens
* for nothing. `{}` turns it on with the defaults. See "Flywheel". Update with
* `superchart.setFlywheel(options | false)`. */
flywheel?: FlywheelOptions | false

// ---- UI Toggles ----

/** Show the drawing toolbar on the left. Default: false */
drawingBarVisible?: boolean

/** Show the volume sub-indicator. Default: true */
showVolume?: boolean

/**
* Seeds the floating drawing toolbar's visibility, host-hidden built-ins
* and host buttons. Visibility and host buttons can be changed later with
* setFloatingToolbarVisible and addFloatingToolbarButton. See "Floating drawing toolbar" below.
*/
floatingToolbar?: FloatingToolbarOptions

// ---- Available Options ----

/**
* Restrict the period selector to a specific list.
* Defaults to: 1m, 5m, 15m, 1H, 2H, 4H, D, W, M
* Users can add their own with "Add custom interval…" in the timeframe menu
* (saved in `ChartState.customPeriods`) or by typing one (`7`, `45`, `3h`,
* `5D` then Enter). Intervals the datafeed doesn't serve natively are built
* from smaller bars; see "Custom timeframes" in docs/data-loading.md.
*/
periods?: Period[]

/**
* Intervals pre-starred as quick pills in the top bar, before the user
* curates their own (short labels, e.g. `'15m'`, `'1D'`). Defaults to
* the exported `DEFAULT_FAVORITE_TIMEFRAMES`. A user star still persists
* to `ChartState.favoritePeriods` and wins over this once set.
*/
favoriteTimeframes?: string[]

/**
* Key combos the host owns, e.g. `['Mod+ArrowUp', 'Shift+B']`. AltradyCharts
* ignores them everywhere (shortcuts, type-ahead, native copy / cut / paste)
* and hides their rows from the `?` panel and Settings -> Hotkeys. Modifier
* order and letter case don't matter. Per chart. See "Reserving keys for the
* host" in keyboard-shortcuts.md.
*/
reservedKeys?: readonly string[]

/**
* The indicators starred in the picker, as picker row ids (`<kind>:<name>`,
* e.g. `script:RSI`, `engine:VOLUME`, `host:<script id>`, `backend:<name>`).
* The user's rather than a layout's, so AltradyCharts doesn't save them: keep
* what `onFavoriteIndicatorsChange` hands you and pass it back here, or call
* `setFavoriteIndicators` when it changes elsewhere. An id with no matching
* indicator is kept and just not shown. Undefined means none.
*/
favoriteIndicators?: string[]
/** A star was toggled in the picker. Fires once, however many charts are open. */
onFavoriteIndicatorsChange?: (ids: string[]) => void

/**
* The current time as unix milliseconds, for when the PC clock can't be
* trusted. Called each time the footer clock updates, so it can follow an
* offset that changes. Must be cheap and synchronous. Omitted, or returning
* something that isn't a finite number: the PC clock.
*/
getNow?: () => number

/**
* Your own buttons in the indicator picker's header, before close. On a
* narrow panel one with an `icon` shows just the icon, with the label as a
* tooltip. Clicking one closes the picker, then calls `onClick`. Labels are
* shown as given, so pass them translated. `icon` is a design-system icon name
* (`code`, `star`, ...) or id (`navigation/Bell`); an unknown name renders an
* empty box. Read when the chart is created.
*/
indicatorPickerActions?: { id: string; label: string; icon?: string; onClick: () => void }[]
}

AltradyChartsApi​

Returned via the onApiReady callback or accessible directly as methods on the AltradyCharts instance.

export interface AltradyChartsApi {
// ---- Theme & Styles ----

setTheme(theme: string): void
getTheme(): string

/** Merge style overrides into the chart. Accepts DeepPartial<PaneProperties>. */
setStyles(styles: DeepPartial<PaneProperties>): void
getStyles(): DeepPartial<PaneProperties>

/**
* Host-owned in-memory style layer. Precedence: design-system theme <
* persisted user styles < host layer. Never persisted. `null` clears it.
*/
setHostStyles(styles: DeepPartial<Styles> | null): void

// ---- Chart settings, for a host's own settings UI ----

/**
* The values the settings modal opens on: `styles` (the chart type as
* drawn) and `preferences` (including `features.*` and `autoSaveDelay`).
* Paths match the modal's `scope: 'styles'` / `scope: 'preferences'` keys.
*/
getSettings(): ChartSettingsValues
/**
* Change and save settings exactly as the settings modal does, side effects
* included. Applied in order: `restore` (styles paths back to the chart's
* defaults), `styles`, then each of `preferences` by path, for example
* { 'scales.priceType': 'logarithm', 'statusLine.ohlc': false }.
* `setStyles` paints without saving.
*/
applySettings(patch: { restore?: string[], styles?: DeepPartial<Styles>, preferences?: Record<string, unknown> }): void

// ---- Locale & Timezone ----

setLocale(locale: string): void
getLocale(): string

setTimezone(timezone: string): void
getTimezone(): string

// ---- Symbol & Period ----

setSymbol(symbol: SymbolInfo): void
getSymbol(): SymbolInfo

setPeriod(period: Period): void
getPeriod(): Period

// ---- Chart Instance ----

// ---- Data and viewport ----

/** The chart's bars, oldest first, timestamps in ms. Read-only; empty before data loads. */
getCandles(): readonly KLineData[]
/** The visible span in seconds, like the visibleRangeChange event; null before data loads. */
getVisibleRange(): VisibleTimeRange | null
/** Show this span (seconds), loading history as needed; waits for the first data. */
setVisibleRange(range: VisibleTimeRange): Promise<void>
/** Pixels per bar. */
getBarSpacing(): number
setBarSpacing(px: number): void
/** Empty space after the last bar, in pixels. */
setRightOffset(px: number): void
scrollToLatest(animationMs?: number): void
/** Centre the bar at `time` (seconds), keeping the zoom and loading history as needed; clamps to
* the first / latest bar. Resolves to the bar's time (seconds), or null with no bars or in replay. */
scrollToTime(time: number, animationMs?: number): Promise<number | null>
/** Default zoom and scroll, at the latest bar; waits for the first data. */
resetView(): Promise<void>
/** Drop the loaded bars and load them again from the datafeed. */
reloadData(): void
/** Whether the user can zoom and scroll; fields left out stay as they are. */
setInteraction(interaction: { zoom?: boolean, scroll?: boolean }): void
getInteraction(): { zoom: boolean, scroll: boolean }

// ---- Chart Instance ----

/**
* The engine chart, for what AltradyCharts doesn't wrap. Prefer the methods
* above: everything reached through here is the engine's API, not
* AltradyCharts's, and can change with it. Lines and handles don't need it:
* createOrderLine, createTradeLine, createPriceAlert and createSmartPosition
* take `sc` (its active chart) or `sc.chart(i)` directly.
*/
getChart(): Nullable<Chart>

// ---- Indicator catalog ----

/**
* The indicator picker's list as data: every indicator the chart can add,
* by category, and which are active. Backend indicators from the
* IndicatorProvider are items with kind 'backend' and ids 'backend:<name>'.
*/
getIndicatorCatalog(): Promise<IndicatorCatalog>

/** Add (`active`) or remove a catalog item by its `id`, as the picker does. */
setIndicatorActive(id: string, active: boolean): Promise<void>

// ---- Script Indicators ----

/**
* Execute a script through the configured scriptProvider and render it
* exactly as the editor's "Add to chart" does. Resolves an opaque scriptId.
* Waits for mount; rejects without a scriptProvider or on execution failure.
*/
addScriptIndicator(params: ScriptIndicatorParams): Promise<string>

/**
* Complete teardown — same path as the pane-legend ✕ (all panes, primitives,
* scriptProvider.stop awaited). No-op for an unknown id.
*/
removeScriptIndicator(scriptId: string): Promise<void>

/**
* Update a running script indicator's settings; scriptId stays stable.
* No-op for an unknown id. Uses scriptProvider.updateSettings when
* implemented; otherwise falls back to an internal stop + re-execute under
* the same scriptId. Never fires the 'scriptIndicatorRemove' event.
*/
updateScriptIndicator(scriptId: string, settings: Record<string, SettingValue>): Promise<void>

/**
* TradingView's "Move to": put a script indicator into the pane above or
* below it ('existing-above' | 'existing-below'), e.g. RSI and Stochastic in
* one pane, or out into a new pane of its own ('new-above' | 'new-below',
* only from a pane it shares). Merged into a pane that already has a scale,
* it gets an independent one of its own. Saved with the chart state, layouts
* and indicator templates; one undo step. Returns false when the move isn't
* possible from where it is. The same moves, plus "Pin to scale", are in
* each legend row's menu (the "…" button, or a right-click on the row).
*/
moveIndicator(scriptId: string, target: IndicatorPaneTarget): boolean

// ---- Utilities ----

/** Trigger a canvas resize (call after the container changes size). */
resize(): void

/**
* Render the chart to a data URL, as the screenshot button does: the chart,
* its legends, and a footer with the brand, market and capture time.
* See "Screenshot" in customization.md.
* @param type - 'png' | 'jpeg'. Default: 'jpeg'.
* @param backgroundColor - CSS color for the background. Default: theme bg.
*/
getScreenshotUrl(type?: 'png' | 'jpeg', backgroundColor?: string): string

// ---- Overlays ----

/**
* Programmatically create an overlay (drawing).
* @param overlay - OverlayCreate with an optional properties field.
* @param paneId - Target pane. Defaults to 'candle_pane'.
* @returns The overlay ID string, or null on failure.
*/
createOverlay(
overlay: OverlayCreate & { properties?: DeepPartial<OverlayProperties> },
paneId?: string
): string | null

/**
* Set the overlay interaction mode.
* 'normal' — select and move overlays
* 'lock' — overlays cannot be moved
*/
setOverlayMode(mode: OverlayMode): void

/**
* Remove every user drawing (drawn, pasted or duplicated). Order, price and
* trade lines and script primitives are untouched. Same as the built-in
* "Remove drawings" menu item.
*/
removeAllDrawings(): void

/**
* Remove every indicator on any pane, including VOL and backend/script
* indicators. Same as the built-in "Remove indicators" menu item.
*/
removeAllIndicators(): void

/**
* The rail's "Lock all drawings": true when there are drawings and every
* one is locked. With none, whether Lock all was left on (new drawings then
* start locked). Follow changes with the 'drawingsLockedChange' event.
*/
getDrawingsLocked(): boolean

/**
* Lock or unlock every user drawing, as the rail's Lock all button does:
* one saved change and one undo step; while on, new drawings start locked.
* The rail shows the same state.
*/
setDrawingsLocked(locked: boolean): void

/** Whether any user drawing is on the chart. false before mount. */
hasDrawings(): boolean

/** Whether any indicator is on the chart. false before mount. */
hasIndicators(): boolean

/**
* Read a drawing's lock/visibility/timeframe-preset state — the same
* values SC's own right-click menu and Object Tree show.
* Returns null if the overlay id isn't on the chart.
*/
getOverlayState(id: string): OverlayState | null

/**
* Change any subset of an overlay's state: { locked?, visible?,
* timeframePreset?, style? }. Same paths as the right-click menu, Object
* Tree and settings dialog, so undo, persistence and autosave behave as
* if the user did it. No-op for an unknown id.
*/
setOverlayState(id: string, patch: OverlayStatePatch): void

/**
* A drawing's templates, by drawing id, through the storage adapter:
* { available, list(id), apply(id, nameOrTemplate), save(id, name),
* remove(id, name), extract(id) }. `available` is false when the
* drawing_templates flag is off or the adapter can't list, load and save.
*/
drawingTemplates(): DrawingTemplates

/**
* The user's drawings, bottom to top: what the drawing tools made, not
* host overlays (order lines, alerts). Each is { id, name (the tool, e.g.
* 'segment', 'rect', 'parallelChannel'), typeLabel (its localized display
* name), points: [{ timestamp (ms), value }], locked, visible,
* extendData? }. Follow changes with the 'overlaysChange' event.
*/
getDrawings(): DrawingInfo[]

/**
* Visual-order op for a user drawing, same as the menu's Bring to front /
* Send to back / Forward / Backward rows. No-op for an unknown id.
*/
reorderOverlay(id: string, op: 'front' | 'back' | 'forward' | 'backward'): void

/** Duplicate an overlay in place. Returns the new overlay's id, or null for an unknown id. */
cloneOverlay(id: string): string | null

/** Copy an overlay to the OS clipboard. Resolves false for an unknown id or a failed copy. */
copyOverlay(id: string): Promise<boolean>

/** Dock the Object Tree panel open or closed. */
setObjectTreeOpen(open: boolean): void

// ---- Floating drawing toolbar ----

/** Add a button to the floating drawing toolbar. Re-adding an existing id replaces it. */
addFloatingToolbarButton(options: FloatingToolbarButtonOptions): void

/**
* Show or hide the whole floating drawing toolbar. Selection, the canvas
* highlight and the right-click menu are unaffected.
*/
setFloatingToolbarVisible(visible: boolean): void

// ---- Top bar ----

/**
* Replace which built-in items compact first (and in what groups) once the
* bar's own measured width actually calls for it — this doesn't change
* *whether* or *when* the bar compacts, only *which* items it picks. Useful
* for a host's own breakpoint (e.g. mobile) reordering that choice. Replaces
* the previous set wholesale; `null` or `{}` restores the defaults, and
* mapping an item to `null` makes it never compact. Host buttons change at
* runtime through their own `data-compact-prio` attribute instead — see
* `createButton`.
*/
setTopBarCompactPrios(overrides: TopBarCompactPrioOverrides | null): void

// ---- Undo / redo ----

/**
* Step back one recorded change to the chart's drawings or indicators.
* Scope is deliberately narrow — preferences, styles and template changes
* are not undoable.
* @returns false when there was nothing to undo.
*/
undo(): Promise<boolean>

/** Step forward one undone change. false when there was nothing to redo. */
redo(): Promise<boolean>

/** Whether a step is available, for a host-drawn toolbar button. */
canUndo(): boolean
canRedo(): boolean

// ---- Compare or Add Symbol ----

/**
* Draw another symbol on this chart. Its bars come from the same datafeed
* (`resolveSymbol`, `getBars`, `subscribeBars`) at the chart's resolution, and
* follow resolution and symbol changes, history paging and live updates.
*
* `mode`: 'percent' (default, TradingView's "Same % scale": the price axis
* switches to percentage), 'scale' ("New price scale": a second price axis on
* the same pane) or 'pane' ("New pane"). `source`: 'close' (default), 'open',
* 'high', 'low', 'hl2', 'hlc3' or 'ohlc4'. `color` defaults to the next colour
* of the theme palette.
*
* Saved with the chart and part of undo/redo. Returns a Promise of the
* comparison's id (not the id itself). Rejects with a clear error for an
* unknown `mode` or `source`, a missing symbol, or a non-positive `lineWidth`.
*/
addCompare(options: { symbol: string | CompareSymbol, mode?: CompareMode, source?: CompareSource, color?: string, lineWidth?: number }): Promise<string>

/** Remove a comparison. Removing the last 'percent' one puts the previous price axis mode back, unless you changed it meanwhile. */
removeCompare(id: string): Promise<void>

/** Change `color`, `lineWidth`, `source`, `mode` or `visible` of a comparison. Rejects on an invalid value, like addCompare. */
updateCompare(id: string, patch: CompareUpdate): Promise<void>

/** The comparisons on this chart, with their drawn colour and load status. */
getCompares(): CompareInfo[]

// ---- Keyboard target ----

/** Make this chart the keyboard target. Ignored when `keyboard_shortcuts` is disabled. */
setActive(): void

/** True while this chart is the keyboard target, including as the fallback. */
isActive(): boolean

/**
* Replace the whole set of reserved key combos (`[]` clears it). Applies from
* the next key press; the `?` panel and Settings read it when they next open.
*/
setReservedKeys(keys: readonly string[]): void

// ---- Events ----

/**
* Subscribe to a chart event (see "Events" below). Returns an unsubscribe
* function. Unknown event names throw. On a `AltradyCharts` with several
* charts, events come from every chart, including charts added later;
* `chart(i).on` listens to one.
*/
on<K extends keyof ChartEvents>(event: K, callback: ChartEvents[K]): () => void

// ---- Lifecycle ----

/** Unmount the chart, remove the klinecharts canvas, and reset all state. */
dispose(): void
}

Events​

Everything the chart reports is an event. Subscribe with on(event, callback) at any time; it returns an unsubscribe function, and an unknown event name throws. Options carry the host's hooks (calls the chart makes to ask the host for something, such as onStorageError or onTradeAction) and the lifecycle hooks onApiReady / onDataLoaded; they are not events.

const unsubSymbol = chart.on('symbolChange', (symbol) => {
TradingTabsController.get()?.activeTab.setCoinraySymbol(symbol)
})

const unsubPeriod = chart.on('periodChange', (period) => {
TradingTabsController.get()?.activeTab.setResolution(period)
})

const unsubRange = chart.on('visibleRangeChange', (range) => {
// range.from and range.to are unix timestamps in seconds
const durationSeconds = range.to - range.from
TradingTabsController.get()?.activeTab.setVisibleRange(range)
})

// Later: stop listening
unsubSymbol()
unsubPeriod()
unsubRange()

Events fire for changes initiated from the UI (e.g. clicking a period button) and from the API (e.g. calling setPeriod()). Initial values set during construction do not fire them.

On a AltradyCharts with several charts, sc.on(...) hears a chart event from every chart, including charts a later setLayout adds; sc.chart(i).on(...) listens to one chart. The layout events at the end of the table are on the AltradyCharts instance's on() only.

Chart events (ChartEvents)​

EventCallbackFires when
activeChange(active: boolean, reason: ActiveChangeReason) => voidThe chart gained or lost the keyboard (see setActive). Fires only when the state flips.
symbolChange(symbol: SymbolInfo) => voidThe symbol changed, from the UI or the API.
periodChange(period: Period) => voidThe period changed, from the UI or the API.
visibleRangeChange(range: VisibleTimeRange) => voidThe visible range changed: scroll, zoom or a data load. Timestamps are unix seconds.
crosshairMove(result: PriceTimeResult) => voidThe crosshair moved: the price and time under the cursor.
click(result: PriceTimeResult) => voidA click on the chart: the clicked price and time.
rightClick(result: PriceTimeResult) => voidA right-click or long-press on empty chart area. The built-in background menu is gated by the chart_context_menu flag, not by this event.
doubleClick(result: PriceTimeResult) => voidA double-click on the chart.
overlayRightClick(event: OverlayEvent<unknown>) => voidA right-click or long-press on a user-drawn overlay. Altrady Charts always prevents the engine's delete-on-right-click; only right_click_menu decides whether its own popup also opens.
overlaysChange(event: OverlaysChangedEvent) => voidThe drawing list changed: create, remove, lock, visibility, order, timeframe rule or an undo/redo step, from any path, or saved drawings were put back ('load': first load, symbol or layout switch, template). Drawings taken off for a switch are not reported; 'remove' is only a removal. The event names which ids changed and why; read current values with getOverlayState.
indicatorsChange() => voidAn indicator joined or left the chart, from any path.
scriptIndicatorRemove(scriptId: string) => voidA script indicator was removed from any path (legend ✕, the API, dispose).
layoutChange(id: string) => voidThe active saved layout (storage key) changed.
drawingToolChange(tool: ActiveDrawingTool | null) => voidA drawing started waiting for points, landed or was cancelled.
selectedDrawingChange(drawing: SelectedDrawing | null) => voidThe selected drawing (the primary one in a multi-selection) changed.
drawingsVisibleChange(visible: boolean) => voidDrawings were shown or hidden.
drawingsLockedChange(locked: boolean) => voidLock all drawings turned on or off (rail, setDrawingsLocked, or drawings locked one by one).
indicatorsVisibleChange(visible: boolean) => voidIndicators were shown or hidden.
magnetModeChange(mode: string) => voidThe magnet mode changed: 'normal' | 'weak_magnet' | 'strong_magnet'.
keepDrawingChange(keep: boolean) => voidKeep-drawing mode was turned on or off.
favoriteToolsChange(tools: FavoriteToolRef[]) => voidThe favourite drawing tools changed.
favoritesBarVisibleChange(visible: boolean) => voidThe favourites bar was shown or hidden.
overlaySettingsOpenChange(open: boolean) => voidA drawing's settings dialog opened or closed.
floatingToolbarItemsChange() => voidThe floating toolbar's items changed: re-read getFloatingToolbarItems.

Layout events (LayoutEvents, on AltradyCharts.on only)​

EventCallbackFires when
multiChartStateChange(state: MultiChartState) => voidThe full state after a change to the layout, its sizes, sync, the active chart, or a chart's symbol or period. Reported once per distinct state.
activeChartChange(index: number) => voidThe active chart changed.
flywheelSlotsChange(slots: (FlywheelSlotRef | null)[]) => voidThe user saved their own wheel from the flywheel's Customize editor.
layoutPresetAction(event: LayoutPresetActionEvent) => voidA layout preset was picked (select), deleted or made the default, or the user asked to save the current layout (save, no id).

Keyboard target (several charts on one page)​

Keyboard input is handled on document, so with more than one chart mounted Altrady Charts routes each key press to exactly one of them: keyboard shortcuts, type-ahead (digits for an interval, a letter for symbol search) and copy / cut / paste. That chart is the keyboard target:

  1. the chart most recently clicked, focused or passed to setActive();
  2. otherwise the last mounted chart that has keyboard_shortcuts enabled.

A chart with keyboard_shortcuts disabled is never the target, not even as the fallback, and setActive() on it is ignored. A single mounted chart is always the target. A modal open on one chart does not block keys for another; a dialog that belongs to no chart (your own aria-modal) still blocks all of them.

export type ActiveChangeReason = 'pointer' | 'focus' | 'api' | 'fallback'

chart2.setActive() // route the keyboard to chart2 without a click
chart2.isActive() // true
const off = chart1.on('activeChange', (active, reason) => {
// fires only when the state flips; the chart that lost the keyboard gets
// (false, reason) and the one that gained it gets (true, reason)
if (reason === 'pointer' || reason === 'focus') syncHostSelection(chart1, active)
})
ReasonMeaning
'pointer'The user pressed a pointer inside the chart (or a menu / popover it opened).
'focus'Focus moved into the chart.
'api'setActive() was called.
'fallback'A chart was mounted, disposed or had keyboard_shortcuts toggled, so the fallback rule picked a new target.

Interaction outside every chart leaves the target unchanged; call setActive() if the host wants a different behaviour.

VisibleTimeRange​

export interface VisibleTimeRange {
/** Unix timestamp (seconds) of the leftmost visible bar */
from: number
/** Unix timestamp (seconds) of the rightmost visible bar */
to: number
}

Compute the visible duration in seconds: range.to - range.from. For example, 100 visible 1-minute candles → 6000 seconds.

Floating drawing toolbar​

Lets a host add its own buttons to the floating toolbar that appears over a selected drawing, place them relative to SC's own buttons, and hide any of SC's built-ins or the whole bar. All state lives on the chart store, so every method — and the floatingToolbar constructor option — works before the chart has finished mounting.

/** Stable ids of SC's own floating-toolbar buttons, in their on-bar order. */
export type FloatingToolbarBuiltinButtonId =
| 'stroke-color' | 'fill-color' | 'text-color' | 'text-size' | 'change-image' | 'anchor-drawing'
| 'table-add-column' | 'table-add-row' | 'table-remove-column' | 'table-remove-row'
| 'line-width' | 'line-style' | 'settings' | 'templates' | 'lock' | 'delete'

/** The selected drawing, read live from the engine when a button is evaluated or clicked. */
export interface FloatingToolbarDrawing {
id: string
/** Engine overlay name, e.g. 'segment'. */
name: string
/** Timestamp in ms, as on the engine overlay. */
points: Array<{ timestamp: number; value: number }>
extendData: unknown
locked: boolean
}

export type FloatingToolbarPlacement = 'start' | 'end' | { before: string } | { after: string }

export interface FloatingToolbarButtonOptions {
/** Host-chosen; re-adding an id replaces it. */
id: string
/** SVG/HTML markup (like ToolbarButtonOptions.icon) or an element. */
icon: string | HTMLElement
tooltip?: string
disabled?: boolean
/** Shown only for these overlay names; omitted = all. */
drawingTypes?: string[]
/** Extra rule, ANDed with drawingTypes. A throwing rule is logged and hides the button. */
visible?: (drawing: FloatingToolbarDrawing) => boolean
/** Default 'end'. An unknown anchor name falls back to 'end' and logs a warning. */
placement?: FloatingToolbarPlacement
onClick: (drawing: FloatingToolbarDrawing) => void
}

export interface FloatingToolbarOptions {
/** Default true. */
visible?: boolean
hiddenButtons?: FloatingToolbarBuiltinButtonId[]
buttons?: FloatingToolbarButtonOptions[]
}

Placement is resolved against the full canonical built-in order before any hiding is applied, so { before: 'settings' } holds even when some of its neighbours are hidden. An anchor may also name another host button's id.

chart.addFloatingToolbarButton({
id: 'create-alert',
icon: '<svg>...</svg>',
tooltip: 'Create alert',
drawingTypes: ['horizontalStraightLine', 'horizontalRayLine', 'horizontalSegment'],
placement: { before: 'settings' },
onClick: (drawing) => console.log('alert for', drawing.id, drawing.points),
})

chart.setFloatingToolbarVisible(false)

Top bar: host buttons and compacting​

As the top bar narrows, items switch to a compact version one priority step at a time, based on their measured widths (no fixed breakpoints). A higher prio compacts first, and equal prios compact together. When everything is compacted and it still doesn't fit, the bar scrolls horizontally.

export interface ToolbarButtonOptions {
/** 'left' = end of the left section; 'right' = start of the right section (before Layout);
* 'right-end' = end of the right section, after AltradyCharts's own buttons. Default 'right'. */
align?: 'left' | 'right' | 'right-end'
/** Directly after this built-in left-cluster item instead, e.g. 'indicator'. Overrides `align`;
* the button shows only while that item does. */
after?: TopBarItem
icon?: string
text?: string
tooltip?: string
onClick?: () => void
/** Opt in to compacting: the text label hides (icon only). Omit to never change;
* the button's width still counts towards the fit. */
compactPrio?: number
}

/** Built-in left-cluster items, in bar order, that `after` can name. */
export type TopBarItem =
| 'market' | 'periods' | 'chartType' | 'indicator' | 'script'
| 'display' | 'alert' | 'replay' | 'undoRedo'

/** Built-in items and their prios, spaced out so hosts can slot in between. */
export const TOP_BAR_COMPACT_PRIOS = {
periods: 100, // one button: selected period + caret
periodsMiddle: 150, // previous / current / next period; skipped unless above `periods`
chartType: 200,
indicator: 300,
replay: 310,
layout: 320, // incl. its save button
} as const
export type TopBarCompactItem = keyof typeof TOP_BAR_COMPACT_PRIOS

/** `null` = that item never compacts; an absent or `undefined` key keeps its default. */
export type TopBarCompactPrioOverrides = Partial<Record<TopBarCompactItem, number | null>>
  • createDropdown accepts the same align and after values, but not compactPrio.
  • after puts host items right next to a built-in, e.g. createButton({ after: 'indicator', icon }) lands between Indicator and the next group. Several items with the same after keep their creation order.
  • The button's DOM contract. createButton returns a .altradycharts-toolbar-btn containing .altradycharts-toolbar-btn-icon and .altradycharts-toolbar-btn-text spans, and Altrady Charts adds .altradycharts-toolbar-btn--compact while it is compacted.
    • Change the label via the text span's textContent, and the tooltip via btn.dataset.tooltip. A title set by the host still works, and shows as the styled tooltip.
    • Change the prio at runtime via btn.dataset.compactPrio; delete btn.dataset.compactPrio means never compact. Altrady Charts recomputes immediately.
    • Remove the button with btn.remove().
  • Built-in overrides go through setTopBarCompactPrios, e.g. { layout: null } to keep Layout full on mobile.
const buy = chart.createButton({
align: 'right-end',
icon: '<i class="fa-solid fa-arrow-up"></i>',
text: 'Buy',
tooltip: 'Buy',
compactPrio: 250,
onClick: openBuy,
})

// Host's own mobile rule
chart.setTopBarCompactPrios(isMobile ? { layout: null } : null)
if (isMobile) delete buy.dataset.compactPrio
else buy.dataset.compactPrio = '250'

Flywheel​

A radial quick-pick for drawing tools, drawing templates and actions. Hold the hotkey over the chart, move toward a tool and release to pick it (releasing in the middle cancels). A quick tap leaves the wheel open: click a tool, or press the key or Esc to close; 1-9 pick a slot. Picking starts the tool exactly as the drawing rail does (armed, drawings un-hidden, same group, lock and magnet mode), so the drawing is grouped, persisted and undoable.

const sc = new AltradyCharts({ container, symbol, period, dataLoader, flywheel: {} })

sc.setFlywheel({ hotkey: 'q', slots: [{ key: 'rect', template: 'Demand zone' }, null] })
sc.setFlywheel(false) // off: no component, no key listener
sc.on('flywheelSlotsChange', (slots) => save(slots))
interface FlywheelOptions {
/** KeyboardEvent.key that opens it. Default '`'. */
hotkey?: string
/** Default wheel, up to 8 slots (null = empty). The user's customised wheel wins. */
slots?: (FlywheelSlotRef | null)[]
/** Show "Customize" in the hub. Default true. */
customizable?: boolean
/** Host actions, slottable as { action: id }. A function is asked on every wheel / editor render. */
actions?: FlywheelAction[] | (() => FlywheelAction[])
/** Asked for every action slot (built-ins too) each time the wheel opens; false greys it out. */
isActionEnabled?: (id: string) => boolean
/** Where the Customize editor mounts; it opens over the window, not the chart. Default document.body. */
modalContainer?: HTMLElement
/** Its stacking order, above the host's own UI. Default 2200. */
modalZIndex?: number
}
type FlywheelSlotRef = FlywheelToolSlotRef | FlywheelActionSlotRef
interface FlywheelToolSlotRef extends FavoriteToolRef { // { key, iconKey?, extendData? }
/** Drawing template (system or StorageAdapter) applied to the new drawing. */
template?: string
}
interface FlywheelActionSlotRef { action: string }
interface FlywheelAction {
id: string
/** Already translated; a function is called on every render (follows a language switch). */
label: string | (() => string)
/** Inline SVG, drawn like the tool glyphs (use currentColor). */
icon: string
/** 'trading', a drawing-bar group id (listed under "Actions" there), or any id (its own group). */
group: string
/** Subheader within the group in the editor (already translated), after its other actions. */
section?: string
/** Disabled where the wheel opened without a price. Default true. */
needsPrice?: boolean
/** The wheel closes; a throw is caught and logged. */
onSelect: (point: FlywheelPoint) => void
}
interface FlywheelPoint {
price: number | null // the price pane only; null over an indicator pane or no pane
time: number | null // unix seconds of the candle under the point
paneId: string | null
x: number // viewport px
y: number
}

Actions. A slot can also hold an action. With onTradeDraftStart set, the built-ins tradeDraftLong and tradeDraftShort (group trading) start a limit draft at the price under the wheel exactly as the cursor + menu does, so onTradeDraftStart fires. Host actions get the opening point in onSelect. An action id nothing registers resolves to an empty slot. For a list that changes at runtime (saved presets, say), pass actions as a function: it is called each time the wheel opens and each time the editor renders, so an action it stops returning leaves its slot empty; a throw is logged and counts as no actions. The opening point is taken when the wheel opens: over the price pane it carries the price; over an indicator pane only paneId and time (its scale isn't a price); over the axes, nothing, and needsPrice actions are greyed out.

A slot names a drawing-bar row the way a pinned favourite does: key is the overlay name, and iconKey / extendData tell the variants that share a key apart ({ key: 'segment', iconKey: 'trendLine' } is the trend line, iconKey: 'ray' the ray). The default wheel is trend line, horizontal line, horizontal ray, rectangle, fib retracement, long position, short position, text; with onTradeDraftStart set it is Long, Short, alert (the host's), trend line, horizontal line, horizontal ray, rectangle, fib retracement. A slot whose tool, template or action no longer exists renders as an empty slot.

A template is looked up under the tool's overlay name (key), system templates first, then StorageAdapter.loadDrawingTemplate; a segment slot also finds the system templates registered under trendLine. The template's properties and figure styles are applied to the new drawing and extendData.templateName is stamped, as applying a template from the menu does. The wheel shows the template by name, tinted with its line, border or fill colour.

MethodDescription
setFlywheel(options | false)Enable, reconfigure or disable, for every chart in the layout and any added later. Disabling keeps the user's saved wheel.
getFlywheelSlots()The wheel in effect on the active chart: the user's, else flywheel.slots, else the built-in default.
setFlywheelSlots(slots)Replace the wheel on every chart as if the user had customised it: saved in ChartState.flywheelSlots, wins over flywheel.slots. Does not fire flywheelSlotsChange.

The flywheelSlotsChange event (sc.on('flywheelSlotsChange', cb)) fires with the new slots when the user saves the Customize editor.

Customize opens an editor (drag a tool, template or action onto a slot, 4, 6 or 8 slots, Reset to default), grouped like the drawing bar with Trading first, templates nested under their tool, and a search across every group. It opens over the whole window (portalled to modalContainer), so a small chart cell still gets a full-size editor; it becomes a bottom sheet only when the window itself is narrow, and the dial shrinks (to 70%) when the window is short. The wheel is per user, not per layout: it is carried across a layout switch and kept in sync across the charts of a multi-chart layout. In a layout the wheel acts on the active chart, and one key press opens one wheel. It does not open while typing in a field or while a modal is open, is skipped when the host reserves its key (reservedKeys), and is off with keyboard_shortcuts. The hotkey is listed in the shortcuts help (?).

Multi-chart layouts​

One AltradyCharts can show up to 8 charts side by side, the way TradingView's multi-chart layouts work: one top bar, drawing bar and bottom bar acting on the active chart (outlined, chosen by clicking a chart), draggable splitters between charts, and optional sync.

const sc = new AltradyCharts({ container, symbol, period, dataLoader, layout: '2-cols' })
sc.setLayout('4-l-3r')
sc.chart(1).setSymbol(eth) // any chart, by index
sc.activeChart().setPeriod(h4) // the outlined one
sc.setSymbol(btc) // the same as activeChart().setSymbol
sc.setLayoutSync({ interval: true, crosshair: true })
sc.on('activeChartChange', (i) => console.log('active chart', i))
MethodDescription
setLayout(id: LayoutId)Switch layout. Existing charts keep their state; new ones copy the active chart's symbol and interval; charts past the new count are disposed and their saved state dropped.
layout()Current LayoutId.
chartsCount()Number of charts in the layout.
chart(index)One chart, with every per-chart method below. Throws RangeError when out of range.
activeChart() / activeChartIndex()The chart the top bar and keyboard act on.
setActiveChart(index)Make a chart active.
layoutSync() / setLayoutSync(patch){ symbol, interval, crosshair, time, dateRange }. Default: only crosshair.
getMultiChartState()The whole grid as plain data: { layout, sizes, sync, active, charts: [{ symbol, period }] }.
setMultiChartState(state)Apply a whole grid at once (e.g. one stored per host tab). Existing charts are reused and keep their drawings and indicators; sync is held off while charts are set; listeners fire once. sizes, sync and active are optional. Throws RangeError for an unknown layout.
setStorageKey(key)Switch the whole grid to another saved record, e.g. one key per host tab: layout, sizes, sync, active chart, each chart's symbol and period, and each chart's own drawings, indicators and panes. Pending edits are saved to the old key first. With nothing saved under key, the layout option applies and chart 0 keeps its symbol.
reloadLayout()Show the current layout as storage now holds it, after something else replaced it there (an import, another device): the grid and every chart's drawings, indicators, panes and styles. Pending edits are discarded, not saved, so they can't write the old layout back. Symbols, periods and user-level settings stay; undo history is cleared. Safe when nothing is stored. Layout lists re-read their names. chart(i).reloadLayout() reloads one chart. Unlike loadState(), which adds the stored state on top of what is shown.
setLayoutPresets(presets){ items: [{ id, name, isDefault? }], activeId? }, or null to hide. Lists host presets at the top of the layout picker, with a "Save current layout as preset…" action. Altrady Charts only lists them; the host applies one (e.g. with setMultiChartState). Call again to update the list or highlight.

Layout events, on sc.on(...) only (see Events):

  • 'activeChartChange': fires with the new index.
  • 'multiChartStateChange': fires with the full state after a layout, size, sync, active-chart, or per-chart symbol (by ticker) / period change, once per distinct state.
  • 'layoutPresetAction': { action: 'select' | 'save' | 'delete' | 'setDefault', id? } (id unset for save). Select and save close the picker; delete and set-default leave it open, with no confirmation.

Options: layout?: LayoutId (default '1') and charts?: Array<{ symbol?, period? }> for the initial charts. A layout saved in storage wins over both, unless persistMultiChartState: false: then Altrady Charts neither restores nor saves the grid (layout, sizes, sync, active chart, each chart's symbol and period) and the host sets it with those options and setMultiChartState. Each chart's own state (indicators, drawings, panes, styles) is saved and restored either way.

Fullscreen mode​

Shift+F, the top-bar button and these methods put the whole Altrady Charts (every chart of a layout) into fullscreen, as in TradingView. The top bar and drawing bar hide there unless the header_in_fullscreen_mode / side_toolbar_in_fullscreen_mode features keep them. Escape leaves it. Shift+F works even with fullscreen_button disabled.

MethodDescription
startFullscreen()Enter fullscreen mode, if not already in it. Browsers only allow this from a user gesture, e.g. a click handler.
exitFullscreen()Leave fullscreen mode, if in it.
isFullscreen()Whether the chart is in fullscreen mode.

LayoutId is one of '1', '2-cols', '2-rows', '3-cols', '3-rows', '3-2l-r', '3-l-2r', '3-2t-b', '3-t-2b', '4-grid', '4-rows', '4-cols', '4-l-3r', '4-3t-b', '4-t-3b', '5-l-2x2', '5-t-4b', '6-2x3', '6-3x2', '7-l-6', '8-2x4', '8-4x2' (NxM is N columns by M rows).

Rules worth knowing:

  • Every per-chart method on AltradyCharts acts on the active chart. With layout '1' that is the only chart, so single-chart code is unaffected.
  • These act on every chart, and are replayed on charts added later: setTheme, setLocale, setTimezone, setHostStyles, setFeatureEnabled, the floating-toolbar methods and setTopBarCompactPrios.
  • createButton / createDropdown make one item, which moves to whichever chart's top bar is showing. The element they return stays valid across active-chart and layout switches.
  • The onApiReady / onDataLoaded options fire once, for the first chart.
  • Chart events subscribed with sc.on(...) ('symbolChange', 'crosshairMove', ...) fire for every chart, including charts a later setLayout adds. Use sc.chart(i).on(...) for a specific chart.
  • Indicator and script providers are shared by all charts and disposed once, by dispose().
  • Each further chart gets its own data loader via AltradyChartsDataLoader.fork() (loaders from createDataLoader have it). A hand-written loader without fork is shared by all charts.
  • The top-bar layout picker is behind the multi_chart_layout feature flag (default off). setLayout() works without it.

Core Types​

SymbolInfo​

export interface SymbolInfo {
/** Unique ticker identifier (e.g. 'BTCUSDT') */
ticker: string
/** Decimal places for price display */
pricePrecision: number
/** Decimal places for volume display */
volumePrecision: number
/** Full display name (e.g. 'Bitcoin / USDT') */
name?: string
/** Abbreviated display name */
shortName?: string
/** Exchange identifier (e.g. 'BINANCE') */
exchange?: string
/** Market category (e.g. 'crypto', 'stock') */
market?: string
/** Quote currency (e.g. 'USDT') */
priceCurrency?: string
/** URL to a logo image */
logo?: string
}

Period​

export interface Period {
/** Unit type */
type: 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'year'
/** Multiplier for the unit */
span: number
/** Display label shown in the period bar (e.g. '1H', '4H', 'D') */
text: string
}

PERIODS constant​

Pre-built Period objects for all standard timeframes:

export const PERIODS: Record<string, Period> = {
'1s': { type: 'second', span: 1, text: '1s' },
'1m': { type: 'minute', span: 1, text: '1m' },
'3m': { type: 'minute', span: 3, text: '3m' },
'5m': { type: 'minute', span: 5, text: '5m' },
'15m': { type: 'minute', span: 15, text: '15m' },
'30m': { type: 'minute', span: 30, text: '30m' },
'1h': { type: 'hour', span: 1, text: '1H' },
'2h': { type: 'hour', span: 2, text: '2H' },
'4h': { type: 'hour', span: 4, text: '4H' },
'6h': { type: 'hour', span: 6, text: '6H' },
'12h': { type: 'hour', span: 12, text: '12H' },
'1D': { type: 'day', span: 1, text: '1D' },
'3D': { type: 'day', span: 3, text: '3D' },
'1W': { type: 'week', span: 1, text: '1W' },
'1M': { type: 'month', span: 1, text: '1M' },
}

ChartState​

The full serializable state saved and loaded by StorageAdapter.

export interface ChartState {
/** Schema version. Currently 1. Used by migrateChartState(). */
version: number
/** Active backend indicator references */
indicators: SavedIndicator[]
/** Saved drawing overlays */
overlays: SavedOverlay[]
/** Style customizations (DeepPartial<Styles> from klinecharts) */
styles: DeepPartial<Styles>
/** Pane height layout */
paneLayout: PaneLayout[]
/** User preferences */
preferences: ChartPreferences
/** Unix ms timestamp of last save */
savedAt?: number
/** Symbol ticker this state was saved for */
symbol?: string
/** Period text this state was saved for */
period?: string
}

StorageAdapter​

export interface StorageAdapter {
load(key: string, context?: StorageContext): Promise<StorageRecord | null>
/** Throws StorageConflictError when `expectedRevision` is stale. */
save(key: string, state: ChartState, expectedRevision?: number, context?: StorageContext): Promise<StorageWriteResult>
delete(key: string): Promise<void>
/** Optional: list all saved keys */
list?(prefix?: string): Promise<StorageEntry[]>

/** Optional: per-account user preferences (load + save opt in). */
loadUserPreferences?(): Promise<UserPreferencesRecord | null>
/** Throws StorageConflictError<Partial<UserPreferences>> when `expectedRevision` is stale; null = create. */
saveUserPreferences?(prefs: Partial<UserPreferences>, expectedRevision: number | null): Promise<StorageWriteResult>
subscribeUserPreferences?(listener: (record: UserPreferencesRecord) => void): () => void

// ...plus optional template and saved-layout methods, see storage.md
}

interface UserPreferencesRecord { prefs: Partial<UserPreferences>; revision: number }

class StorageConflictError<T = ChartState> extends Error {
remoteState: T // ChartState from `save`, Partial<UserPreferences> from `saveUserPreferences`
remoteRevision: number
constructor(remoteState: T, remoteRevision: number, message?: string)
}

UserPreferences is the per-user subset of ChartState (favourite tools, timeframes, chart types and layouts, flywheel, favourites bar, drawing toolbar visibility, trade overlay choices, drawing settings tab, "Keep text", feature overrides). With loadUserPreferences + saveUserPreferences they are stored once per account and merged on conflict instead of living in each layout; see storage.md, "User preferences".


Helper Functions​

All exported from the @altrady/charts package root.

createDataLoader​

function createDataLoader(datafeed: Datafeed): AltradyChartsDataLoader

Wraps a Datafeed into a klinecharts DataLoader. Handles symbol caching, period-to-resolution conversion, and period-aligned timestamp computation. Also extends DataLoader with searchSymbols, getSymbolTypes and setOnBarsLoaded.

The optional Datafeed.getSymbolTypes(onResult) supplies the symbol-search tabs and takes precedence over DatafeedConfiguration.symbols_types; AltradyChartsDataLoader.getSymbolTypes(onResult) resolves the two (method first, then symbols_types, then []). DatafeedSymbolType is { name: string; value: string }.

See data-loading.md for full details.

registerOverlay​

function registerOverlay(template: OverlayTemplate): void

Register a custom overlay type. The template defines the overlay name, how many click steps it requires, and how to render its figures. Call before new AltradyCharts() or before first use.

See overlays.md — Custom Overlays for full examples.

registerFigure​

function registerFigure(template: FigureTemplate): void

Register a custom figure primitive (canvas shape). Custom overlays can reference registered figures by name in their createPointFigures return values.

registerIndicator​

function registerIndicator(template: IndicatorTemplate): void

Register a custom indicator template. The template defines the indicator name, calculation function, and figure rendering.

createOrderLine​

function createOrderLine(chart: Chart, options?: Partial<OrderLineProperties>): OrderLine

Creates a horizontal price-level overlay with body, quantity, and cancel button sections. Returns a handle with get(), set(patch) and remove(); callbacks (onCancel, onModify, onMove...) are plain options. See overlays.md for the full OrderLine interface and OrderLineProperties.

loadLocale​

function loadLocale(key: string, messages: Record<string, string>): void

Register a custom locale. After calling this, pass key as the locale option or to setLocale().

import { loadLocale } from '@altrady/charts'

loadLocale('nl-NL', {
indicator: 'Indicator',
drawing: 'Tekenen',
// ...
})

formatPeriod​

function formatPeriod(period: BasePeriod): string

Converts a Period object to a short display string: { type: 'hour', span: 4 } → '4H'.

resolutionToPeriod​

function resolutionToPeriod(resolution: string): Period

Converts a resolution string ('1', '60', '1D', '1W', '1M') to a Period object.

periodToResolution​

function periodToResolution(period: BasePeriod): string

Inverse of resolutionToPeriod. Converts a Period to a resolution string.


Type Glossary​

TypeSourceDescription
Nullable<T>klinechartsT | null
DeepPartial<T>klinechartsRecursive partial
ChartklinechartsRaw klinecharts chart instance
StylesklinechartsFull chart style tree
OverlayCreateklinechartsOverlay creation options
OverlayTemplateklinechartsTemplate for defining custom overlay types
OverlayModeklinecharts'normal' | 'lock' | ...
FigureTemplateklinechartsTemplate for defining custom figure primitives
IndicatorTemplateklinechartsTemplate for defining custom indicator types
ProOverlayTemplateklinechartsExtended overlay template with property management
DataLoaderklinechartsklinecharts data-loading interface
PaneOptionsklinechartsPane creation options
PaneLayoutaltradycharts{ id, height, minHeight?, state, order }
SavedIndicatoraltradychartsSerialized indicator reference for storage
SavedOverlayaltradychartsSerialized overlay for storage
UserPreferencesaltradychartsThe per-user ChartState fields, stored per account by an adapter that implements loadUserPreferences / saveUserPreferences
UserPreferencesRecordaltradycharts{ prefs: Partial<UserPreferences>, revision: number }
ChartPreferencesaltradycharts{ showVolume, showCrosshair, showGrid, showLegend, magnetMode, timezone?, locale? }
SettingValuealtradychartsnumber | boolean | string
ActiveIndicatoraltradychartsRuntime indicator state (data Map, timestamps, paneId)
VisibleTimeRangealtradycharts{ from: number, to: number } — unix timestamps in seconds
PanePropertiesaltradychartsStyles extended with background gradient fields