interface WidgetContext {
    bus: WidgetBus<WidgetBusEvents>;
    chart: Chart;
    chartTheme: ChartTheme;
    document: Document;
    draw: DrawingController;
    keymap: Keymap;
    locale: undefined | string;
    objects?: ChartObjects;
    overlays: OverlayStack;
    root: HTMLElement;
    storage: WidgetStorage;
    theme: WidgetThemeName;
    tips: TipController;
    interval(): string;
    openOverlay(el: HTMLElement, opts?: OverlayOptions): () => void;
    status(text: string, kind?: "error" | "info"): void;
    symbol(): { exchange: string; symbol: string };
    toast(message: string, kind?: ToastKind): ToastHandle;
}

Properties

chart: Chart
chartTheme: ChartTheme

The engine palette the chart is drawing with.

document: Document
keymap: Keymap
locale: undefined | string
objects?: ChartObjects

Live inventory owned by the widget, optional for custom contexts.

overlays: OverlayStack

The overlay stack behind openOverlay, for a module that needs to ask what is open.

root: HTMLElement

The .oac-widget element every piece of chrome lives in.

storage: WidgetStorage

Per-widget persisted preferences; enabled is false when persist is off.

dark or light, following the chart theme in force.

Hover labels for controls.

Methods

  • Show el over the widget: positioned from opts.anchor (or centred as a dialog), focus-trapped, closed by Escape and by a press outside. Returns the closer.

    Parameters

    Returns () => void

  • Put a transient message on the status line.

    Parameters

    • text: string
    • Optionalkind: "error" | "info"

    Returns void

  • The current symbol and interval, for dialogs that name them.

    Returns { exchange: string; symbol: string }