Skip to content

Documentation / @finchart/core / index / ChartLayers

Interface: ChartLayers ​

Defined in: packages/core/src/render/types.ts:178

The layers a chart sets up inside a container.

Data draws onto the canvas; anything needing DOM events and accessibility, like annotations and tooltips, goes onto the overlay. Redrawing the canvas leaves the overlay untouched.

Properties ​

data ​

readonly data: DrawSurface

Defined in: packages/core/src/render/types.ts:179


overlay ​

readonly overlay: unknown

Defined in: packages/core/src/render/types.ts:188

The layer annotations, DOM labels, and dividers sit on. Core doesn't know what this is — a browser layer puts an element in it, a headless layer puts null in it, and core just passes it along. A collaborator that requires an overlay (DOM labels, dividers, legend, tooltip) narrows it at its own door (requireOverlayElement), or throws a wiring error if there isn't one.

Methods ​

destroy() ​

destroy(): void

Defined in: packages/core/src/render/types.ts:212

Returns ​

void


resize() ​

resize(width, height): void

Defined in: packages/core/src/render/types.ts:197

Fits to this size. Should do nothing if nothing changed.

The chart calls this right before drawing, every frame. A canvas's bitmap gets wiped the instant its backing store is re-grabbed, so if the moment of clearing and the moment of drawing drift apart, an empty screen shows in between — that's the flicker you see during a resize.

Parameters ​

width ​

number

height ​

number

Returns ​

void


screenshot()? ​

optional screenshot(): string

Defined in: packages/core/src/render/types.ts:204

The current pixels as a PNG data URL. Only exists on a layer that has a canvas — this lives here because the layer owns the pixels. A headless layer has no pixels to capture. With DOM-label wiring, the picture comes out missing the labels.

Returns ​

string


setCursor()? ​

optional setCursor(cursor): void

Defined in: packages/core/src/render/types.ts:211

The cursor shape over the surface the pointer touches. null releases it. The layer owns the cursor — same reason it's here as pixels. A headless layer has no cursor to show, so it's omitted, and the caller (Plot) skips past it if it's absent.

Parameters ​

cursor ​

string | null

Returns ​

void