Skip to content

PlotLayerOptions

Defined in: map/plot.ts:8

Declarative interaction options shared by every engine’s retained layers. The machinery (hover overlay, tooltip, selection styling, hit-testing) lives entirely in BaseEngine — these options are just the per-layer surface that both BaseEngine.select’s and the hover/tooltip dispatch read. Plot.layer()/Plot.points() and GeoMap.layer() forward them into the LayerSpec via BaseEngine.interactionFields, so the contract has one home.

D = any

optional anchor?: (d, i) => [number, number]

Defined in: map/plot.ts:39

Glyph anchor in world coords per datum. In “screen” sizeMode the drawable is rendered at a constant pixel size around this point (e.g. a pie pinned to a tree node).

D

number

[number, number]


optional clipTo?: string

Defined in: map/plot.ts:32


optional declutter?: number

Defined in: map/plot.ts:42

Screen-space declutter radius (px): on each zoom, hide anchored glyphs that overlap an already-kept one (earlier data wins). Pairs with anchor + “screen” sizeMode.


draw: (ctx, datum, index) => void

Defined in: map/plot.ts:18

Draw one datum’s geometry by emitting path commands. The context is typed as CanvasRenderingContext2D so d3 generators that render to a context — d3.linkHorizontal(), d3.linkRadial(), d3.line(), d3.arc(), geoPath(projection, ctx), d3.ribbon(), … — accept it directly with no cast. Only the path-building subset (moveTo/lineTo/bezierCurveTo/quadraticCurveTo/ arc/arcTo/rect/closePath) is implemented; fills/strokes come from the layer options below, not from context state.

CanvasRenderingContext2D

D

number

void


optional fill?: string | ((d, i) => string)

Defined in: map/plot.ts:19


optional hover?: HoverOption<D>

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

Hover-highlight: true = default white outline, a HighlightStyle = redraw the hovered item with it, or a custom (datum, HighlightBuilder) draw fn. Rendered in a tiny overlay layer — O(hovered item) per change, the base layer is untouched.

InteractiveLayerOptions.hover


optional id?: (d, i) => string | number

Defined in: map/plot.ts:33

D

number

string | number


optional lineCap?: LineCap

Defined in: map/plot.ts:31

End-cap style for open strokes: “butt” (default) | “square” | “round”. Consistent across WebGL/Canvas/SVG.


optional lineJoin?: LineJoin

Defined in: map/plot.ts:25

Stroke corner style: “bevel” (default) | “miter” | “round”. Applies to the whole layer; rendered identically across WebGL/Canvas/SVG.


optional lineWidth?: number | ((d, i) => number)

Defined in: map/plot.ts:22

A constant width, or a per-datum width (e.g. branch thickness ∝ subtended terminals).


optional miterLimit?: number

Defined in: map/plot.ts:28

Miter length / stroke width above which a miter falls back to a bevel (default 10, matching the Canvas 2D default). Only affects “miter” joins.


optional pickable?: boolean

Defined in: map/plot.ts:45

When false, skip the CPU hit index (no hover/pick) — saves an Entry per datum on huge non-interactive layers.


optional selection?: SelectionOptions

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

Styles for BaseEngine.select: the selected set and its complement. Defaults: selected keeps the base style; others { opacity: 0.3 }.

InteractiveLayerOptions.selection


optional sizeMode?: "world" | "screen"

Defined in: map/plot.ts:36

“world” (default): geometry scales with zoom. “screen”: constant pixel size — anchored glyphs keep their size, strokes keep their pixel width. See anchor.


optional stroke?: string | ((d, i) => string)

Defined in: map/plot.ts:20


optional tooltip?: (d, id) => string | HTMLElement | null

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

Hover tooltip content for this layer (null hides). Shown in a shared engine-managed div — see tooltipClass for styling. Re-evaluated only when the hovered target changes; re-declare the layer to force a refresh.

D

string | number

string | HTMLElement | null

InteractiveLayerOptions.tooltip