Skip to content

charton API


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

Interface: ChartGrid ​

Defined in: ui/src/grid.ts:103

A grid of chart shells made by createChartGrid: its cells and charts, the active cell, layout and sizes, the link group, theme, saved layouts and events.

Properties ​

active ​

readonly active: ChartShell

Defined in: ui/src/grid.ts:122

The cell the toolbar acts on.


activeIndex ​

readonly activeIndex: number

Defined in: ui/src/grid.ts:123


cells ​

readonly cells: readonly ChartShell[]

Defined in: ui/src/grid.ts:107

The shell in each cell, by row.


charts ​

readonly charts: readonly Chart[]

Defined in: ui/src/grid.ts:108


el ​

el: HTMLElement

Defined in: ui/src/grid.ts:104


layout ​

readonly layout: ChartGridLayout

Defined in: ui/src/grid.ts:111


readonly links: LinkGroup

Defined in: ui/src/grid.ts:110

Keeps the charts in step; every cell is in it.


sizes ​

readonly sizes: ChartGridSizes

Defined in: ui/src/grid.ts:118


theme ​

readonly theme: ShellTheme

Defined in: ui/src/grid.ts:126


toolbar ​

readonly toolbar: ToolbarHandle | null

Defined in: ui/src/grid.ts:105

Methods ​

destroy() ​

destroy(): void

Defined in: ui/src/grid.ts:139

Returns ​

void


loadLayout() ​

loadLayout(data, options?): ChartGridLoadResult

Defined in: ui/src/grid.ts:136

Restore a grid from serializeLayout. Invalid parts are skipped and listed in errors; a missing sizes list means equal sizes. Throws, changing nothing, when data is not a saved grid or a new chart cannot be created.

Parameters ​

data ​

unknown

options? ​

LayoutLoadOptions

Returns ​

ChartGridLoadResult


on() ​

on<K>(event, listener): () => void

Defined in: ui/src/grid.ts:138

Subscribe to grid events; returns an unsubscribe function.

Type Parameters ​

K ​

K extends keyof ChartGridEvents

Parameters ​

event ​

K

listener ​

(payload) => void

Returns ​

() => void


serializeLayout() ​

serializeLayout(options?): ChartGridState

Defined in: ui/src/grid.ts:130

The grid to store and restore with loadLayout. options go to each chart's serializeLayout.

Parameters ​

options? ​

LayoutSerializeOptions

Returns ​

ChartGridState


setActive() ​

setActive(index, options?): void

Defined in: ui/src/grid.ts:125

Make a cell active; with focus, also move keyboard focus to its chart.

Parameters ​

index ​

number

options? ​
focus? ​

boolean

Returns ​

void


setLayout() ​

setLayout(layout): void

Defined in: ui/src/grid.ts:117

Switch preset. Cells past the new count are destroyed from the end, new ones are created with the cell options, and the sizes are reset. Throws, keeping the previous layout, when a new chart cannot be created.

Parameters ​

layout ​

ChartGridLayout

Returns ​

void


setSizes() ​

setSizes(sizes): void

Defined in: ui/src/grid.ts:120

Set column widths and row heights; lists of the wrong length are ignored, the rest are scaled to sum to 1.

Parameters ​

sizes ​

Partial<ChartGridSizes>

Returns ​

void


setTheme() ​

setTheme(theme): void

Defined in: ui/src/grid.ts:128

Switch the grid and every cell to theme.

Parameters ​

theme ​

ShellTheme

Returns ​

void