interface ChartGrid {
    isDestroyed: boolean;
    ready: Promise<void>;
    root: HTMLElement;
    active(): ChartGridCell;
    addLinkGroup(
        cell: string,
        options?: { links?: LinkOptions; name?: string },
    ): null | string;
    applyWorkspace(payload: WorkspacePayload): ChartGridApplyReport;
    cells(): readonly ChartGridCell[];
    compact(): boolean;
    destroy(): void;
    downloadScreenshot(filename?: string): boolean;
    getWorkspace(): WorkspacePayload;
    layout(): ChartGridLayout;
    linkGroups(): readonly ChartGridLinkGroup[];
    linkOptions(): Required<LinkOptions>;
    maximize(id?: string): boolean;
    maximized(): null | string;
    on<K extends ChartGridEventName>(
        event: K,
        cb: (payload: ChartGridEvents[K]) => void,
    ): () => void;
    renameLinkGroup(group: string, name: string): boolean;
    restore(): void;
    restored(): null | ChartGridApplyReport;
    setActive(id: string, options?: { focus?: boolean }): boolean;
    setGroupLinks(group: string, patch: LinkOptions): boolean;
    setLinkGroup(cell: string, group: null | string): boolean;
    setLinks(patch: LinkOptions): void;
    setPreset(preset: ChartGridLayoutId): void;
    setTheme(theme: ChartTheme | WidgetThemeName): void;
    shareDrawings(cell: string): number;
    swap(first: string, second: string): boolean;
    takeScreenshot(): null | HTMLCanvasElement;
    theme(): WidgetThemeName;
}

Properties

isDestroyed: boolean
ready: Promise<void>

Settles once the persisted workspace has been read and applied (since 2.5.10): at once without persist or over a synchronous store. Over an asynchronous one (IndexedDB, the default) the grid is built from the preset, out of sight and loading nothing, until then; a workspace applied meanwhile wins over the stored one. Never rejects.

root: HTMLElement

The .oac-grid element.

Methods

  • Start a group with this chart in it; the id, or null for an unknown chart or when sixteen groups exist.

    Parameters

    • cell: string
    • Optionaloptions: { links?: LinkOptions; name?: string }

    Returns null | string

  • Whether the grid is narrow enough to show one chart at a time.

    Returns boolean

  • Save takeScreenshot() as a PNG. False when there is no image or the runtime cannot save it.

    Parameters

    • Optionalfilename: string

    Returns boolean

  • Show one chart alone, the active one by default; the others stay alive. False for an unknown id or a single chart.

    Parameters

    • Optionalid: string

    Returns boolean

  • The maximized chart's id, or null while the grid shows every chart.

    Returns null | string

  • Name a group, 1 to 120 characters after trimming.

    Parameters

    • group: string
    • name: string

    Returns boolean

  • What restoring the persisted workspace did when the grid was built: null when nothing was stored, and until ready settles over an asynchronous store. A refused desk stays stored, untouched, until the user changes the grid.

    Returns null | ChartGridApplyReport

  • Make a cell the one the keyboard and shared controls act on. False for an unknown id.

    Parameters

    • id: string
    • Optionaloptions: { focus?: boolean }

    Returns boolean

  • Move a chart into a group, or out of every group with null. It adopts what the group links on.

    Parameters

    • cell: string
    • group: null | string

    Returns boolean

  • Switch channels of the active chart's group, or of every group when it is in none. Switching symbol, interval or chart type linking on adopts the active chart's choice.

    Parameters

    Returns void

  • Reflow into a layout. The charts that fit keep their state in reading order and new ones copy the active chart's instrument; in an uneven layout the active chart takes the large slot, and stays even when it sat past the charts that fit. Weights reset to the layout's. Throws for an id that is not in CHART_GRID_LAYOUTS.

    Parameters

    Returns void

  • Send a chart's drawings to the charts its group shares drawings with, on the same instrument. Drawings made before the switch went on stay private until shared. The number shared, 0 when there is nowhere to share them.

    Parameters

    • cell: string

    Returns number

  • Trade the places of two charts, spans included. False for an unknown or repeated id.

    Parameters

    • first: string
    • second: string

    Returns boolean

  • One image of every chart at its place on the grid, at the device pixel ratio. Null while the grid shows one chart at a time (compact or maximized), when the hidden charts would come out blank.

    Returns null | HTMLCanvasElement