Skip to content

Plot

Defined in: map/plot.ts:92

  • BaseEngine

new Plot(host, opts?): Plot

Defined in: map/plot.ts:105

HTMLElement

PlotOptions = {}

Plot

BaseEngine.constructor

clearStyle(name, ids?): this

Defined in: map/base-engine.ts:1163

Remove overrides (all of the layer’s when ids is omitted) and restore base styles.

string

string | number | readonly (string | number)[]

this

BaseEngine.clearStyle


destroy(): void

Defined in: map/base-engine.ts:2210

void

BaseEngine.destroy


disableInteraction(): this

Defined in: map/base-engine.ts:1522

Detach the current pan/zoom or rotation interaction (no-op if none).

this

BaseEngine.disableInteraction


enableZoom(extent?, onTransform?): this

Defined in: map/base-engine.ts:2021

Enable scroll-to-zoom / drag-to-pan via d3-zoom, clamped to extent. The optional onTransform callback fires once per drawn gesture frame, with the view just drawn — use it to keep an HTML overlay (e.g. a LabelLayer) aligned with the GPU geometry as the view changes. Wheel ticks and pan moves draw once per animation frame, however many arrive in it (#367): the latest transform wins, and the gesture’s end draws its last one before it settles. It also fires once here, with the view current at enable time (the one last passed to setTransform, identity by default), so the overlay starts in step. It does not fire for a later programmatic setTransform: the caller already knows that view. A drag that starts on a draggable glyph moves the glyph instead (#140). Holding ⌘ (Ctrl on Windows/Linux) makes any drag pan, even over a glyph (#178).

[number, number] = ...

(t) => void

this

BaseEngine.enableZoom


highlight(name, idOrIds, style?): this

Defined in: map/base-engine.ts:1309

Highlight one drawable / a set of drawables of name by drawing them into a tiny internal overlay layer on top (inheriting the source’s clipTo/sizeMode) — the base layer’s buffers are untouched, so the per-change cost is tessellating the highlighted items only. styleOrDraw falls back to the layer’s hover option, then to the default white outline. null clears.

The draw-fn overload is generic over the layer’s datum type D (caller-asserted, like select’s predicate) so a custom highlight draw sees a typed datum.

string

string | number | readonly (string | number)[] | null

HighlightStyle

this

BaseEngine.highlight

highlight<D>(name, idOrIds, draw): this

Defined in: map/base-engine.ts:1310

Highlight one drawable / a set of drawables of name by drawing them into a tiny internal overlay layer on top (inheriting the source’s clipTo/sizeMode) — the base layer’s buffers are untouched, so the per-change cost is tessellating the highlighted items only. styleOrDraw falls back to the layer’s hover option, then to the default white outline. null clears.

The draw-fn overload is generic over the layer’s datum type D (caller-asserted, like select’s predicate) so a custom highlight draw sees a typed datum.

D = unknown

string

string | number | readonly (string | number)[] | null

HighlightDraw<D>

this

BaseEngine.highlight


labels(data): this

Defined in: map/plot.ts:124

Show engine-owned text labels (#223): supply the data and d3-style accessors, and the engine measures each label’s text once, then places + culls collisions and re-places them on every pan/zoom (no manual overlay, transform callback, or text-metric estimates). Rendered by the active backend — an HTML overlay on WebGL, native <text>/fillText on SVG/Canvas so labels survive toSVG()/toPNG() export. Pass false to remove; re-call to rebuild after the bound data or positions change.

false

this

labels<D>(data, opts): this

Defined in: map/plot.ts:125

Show engine-owned text labels (#223): supply the data and d3-style accessors, and the engine measures each label’s text once, then places + culls collisions and re-places them on every pan/zoom (no manual overlay, transform callback, or text-metric estimates). Rendered by the active backend — an HTML overlay on WebGL, native <text>/fillText on SVG/Canvas so labels survive toSVG()/toPNG() export. Pass false to remove; re-call to rebuild after the bound data or positions change.

D

readonly D[]

DataLabelOptions<D>

this


layer<D>(name, data, opts): LayerHandle<D>

Defined in: map/plot.ts:278

Declare (or re-declare) a named layer of arbitrary data, each datum drawn by the opts.draw callback emitting path commands — so d3-shape/d3-geo generators that render to a context (d3.line(), d3.arc(), geoPath(projection, ctx), …) work directly. Geometry is tessellated once and retained, so all three backends render it identically and it stays crisp under zoom. Re-declaring an existing name resets its base styles. Returns a LayerHandle for appending data and per-layer styling. For large point sets prefer Plot.points, which batches them through the shared instanced lane.

D

the datum type passed to draw and the accessors.

string

readonly D[]

PlotLayerOptions<D>

LayerHandle<D>


on(event, cb): this

Defined in: map/base-engine.ts:2123

"click" | "hover"

(hit, ev) => void

this

BaseEngine.on

on(event, cb): this

Defined in: map/base-engine.ts:2124

"select"

(selected, ev?) => void

this

BaseEngine.on


pick(x, y, exact?): HoverHit | null

Defined in: map/base-engine.ts:2143

number

number

boolean = true

HoverHit | null

BaseEngine.pick


points<D>(name, data, opts): LayerHandle<D>

Defined in: map/plot.ts:296

Declare (or re-declare) a named layer of points positioned by opts.x/opts.y, rendered through the shared instanced point lane (one draw call for the whole layer). Prefer this over Plot.layer for large point sets: it scales to millions and supports screen-space declutter. data may be an array or a callback; with passThrough: true points stream uncapped but aren’t pickable. Re-declaring an existing name resets its interaction/style state. Returns a LayerHandle for appending data and per-layer styling.

D

the datum type passed to the accessors.

string

readonly D[] | (() => readonly D[])

PlotPointOptions<D>

LayerHandle<D>


recolor(name): this

Defined in: map/base-engine.ts:1134

string

this

BaseEngine.recolor


render(): this

Defined in: map/base-engine.ts:2199

this

BaseEngine.render


select(name, set): this

Defined in: map/base-engine.ts:1216

Select a set of drawables: style members with the layer’s selection.selected (default: keep base style) and the complement with selection.others (default { opacity: 0.3 }). One O(n) compose + one styles-only push — click-time cost only, nothing per frame. null clears. NOTE: selection rewrites the layer’s whole override map, so it replaces earlier setStyle overrides (one table, last write wins) — and select(null) restores plain base styles.

Also updates the managed selection set and fires on("select") with ev = undefined (programmatic — no PointerEvent), so callers can observe programmatic selection the same way they observe gesture selection.

On a layer the engine has yet to draw (awaitedLayer, e.g. a network waiting for its LOD tree) the selection is kept and observed at once, and styled when the layer is drawn.

The predicate overload is generic over the layer’s datum type D — annotate the parameter ((d: MyDatum) => …) or pass select<MyDatum>(…) to get a typed datum, mirroring d3-selection’s caller-asserted datum generics. Prefer the layer handle’s LayerHandle.select, which already knows D from registration.

string

readonly (string | number)[] | null

this

BaseEngine.select

select<D>(name, predicate): this

Defined in: map/base-engine.ts:1217

Select a set of drawables: style members with the layer’s selection.selected (default: keep base style) and the complement with selection.others (default { opacity: 0.3 }). One O(n) compose + one styles-only push — click-time cost only, nothing per frame. null clears. NOTE: selection rewrites the layer’s whole override map, so it replaces earlier setStyle overrides (one table, last write wins) — and select(null) restores plain base styles.

Also updates the managed selection set and fires on("select") with ev = undefined (programmatic — no PointerEvent), so callers can observe programmatic selection the same way they observe gesture selection.

On a layer the engine has yet to draw (awaitedLayer, e.g. a network waiting for its LOD tree) the selection is kept and observed at once, and styled when the layer is drawn.

The predicate overload is generic over the layer’s datum type D — annotate the parameter ((d: MyDatum) => …) or pass select<MyDatum>(…) to get a typed datum, mirroring d3-selection’s caller-asserted datum generics. Prefer the layer handle’s LayerHandle.select, which already knows D from registration.

D = unknown

string

(d, i) => boolean

this

BaseEngine.select


selection(): HoverHit[]

Defined in: map/base-engine.ts:2628

Flatten the retained selection into HoverHit[], resolving datums + members() via the layer’s Scene spec or its interactive lane (so a selected aggregate’s leaf ids are reachable, #105 N7c-2).

HoverHit[]

BaseEngine.selection


setBackend(type): this

Defined in: map/base-engine.ts:1509

BackendType

this

BaseEngine.setBackend


setClip(name, clipTo?): this

Defined in: map/base-engine.ts:1494

string

string

this

BaseEngine.setClip


setSize(width, height): this

Defined in: map/base-engine.ts:569

Resize the engine in place to a new CSS size (px) — no teardown. Resizes the live backend, runs the subclass onResize hook (e.g. GeoMap refits its projection), then re-renders and repaints pass-through layers. Layers, view transform, and interaction state are preserved. A no-op when the size is unchanged or either axis is zero (a collapsed/hidden layout). In responsive modes the ResizeObserver calls this automatically; callers in fixed mode use it to apply a new explicit size without recreating the engine.

number

number

this

BaseEngine.setSize


setStyle(name, ids, override): this

Defined in: map/base-engine.ts:1149

Override the style of one drawable or a set (replaces any previous override for those ids — last write wins). O(ids) compose + one styles-only push.

string

string | number | readonly (string | number)[]

StyleOverride

this

BaseEngine.setStyle


setTransform(t): this

Defined in: map/base-engine.ts:1563

ViewTransform

this

BaseEngine.setTransform


toPNG(): string

Defined in: map/base-engine.ts:2209

string

BaseEngine.toPNG


toSVG(): string

Defined in: map/base-engine.ts:2208

string

BaseEngine.toSVG


whenReady(): Promise<void>

Defined in: map/base-engine.ts:589

Promise<void>

BaseEngine.whenReady