Skip to content

LayerProps

Defined in: react/Plot.tsx:16

Props for a Layer child of Plot: the imperative engine.layer(name, data, opts) arguments expressed declaratively.

D = unknown

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

Defined in: map/plot.ts:48

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]

PlotLayerOptions.anchor


optional clipTo?: string

Defined in: map/plot.ts:41

PlotLayerOptions.clipTo


data: readonly D[]

Defined in: react/Plot.tsx:18


optional declutter?: number

Defined in: map/plot.ts:51

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.

PlotLayerOptions.declutter


optional draggable?: boolean

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

Opt this layer’s glyphs into node-drag (#140): a plain drag starting on a glyph moves it (instead of panning), reheating the layout. Honored only by engines that implement node-drag (BaseEngine.beginNodeDrag — currently network()); ignored by geoMap/plot. The pointer listeners are attached when the layer is registered, like selectable.

PlotLayerOptions.draggable


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

Defined in: map/plot.ts:27

Draw one datum’s geometry by emitting path commands. The context is deliberately 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 (d3’s typings demand the full context). At runtime the engine passes a PathContext — 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, and non-path members don’t exist at runtime. Hand-written draw code that wants the honest contract can type its own helper against the exported PathContext.

CanvasRenderingContext2D

D

number

void

PlotLayerOptions.draw


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

Defined in: map/plot.ts:28

PlotLayerOptions.fill


optional hover?: HoverOption<D> | HoverOptions<D>

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

Hover-highlight, symmetric with selection (#162). true enables the default outline/ring. A HoverOptions object — { hovered?, others? } — styles it: hovered is how the hovered item looks (a HighlightStyle redraw / custom (datum, HighlightBuilder) draw fn on Scene layers; the ring’s stroke on instanced lanes), and others fades the non-hovered glyphs (the hover analogue of selection.others, opt-in — honored on instanced lanes via the shader, so it’s a uniform change that stays free even on a full LOD-off draw). A bare HighlightStyle/draw-fn is still accepted as shorthand for { hovered: … }. The hovered item is redrawn in a tiny overlay layer — O(hovered item) per change; the base layer is untouched.

PlotLayerOptions.hover


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

Defined in: map/plot.ts:42

D

number

string | number

PlotLayerOptions.id


optional lineCap?: LineCap

Defined in: map/plot.ts:40

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

PlotLayerOptions.lineCap


optional lineJoin?: LineJoin

Defined in: map/plot.ts:34

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

PlotLayerOptions.lineJoin


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

Defined in: map/plot.ts:31

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

PlotLayerOptions.lineWidth


optional miterLimit?: number

Defined in: map/plot.ts:37

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

PlotLayerOptions.miterLimit


name: string

Defined in: react/Plot.tsx:17


optional pickable?: boolean

Defined in: map/plot.ts:54

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

PlotLayerOptions.pickable


optional selectable?: boolean | { multi?: boolean; }

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

Opt this layer into click-driven selection. true or {} = single-select (plain click replaces the selection). { multi: true } = shift/cmd/ctrl-click toggles add/remove; plain click replaces. Omitting this option leaves the layer un-selectable (no gesture, no styling on click). The pointer listeners are attached when the layer is registered — independently of on("select"), which is a pure observer.

PlotLayerOptions.selectable


optional selection?: SelectionOptions

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

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

PlotLayerOptions.selection


optional sizeMode?: "world" | "screen"

Defined in: map/plot.ts:45

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

PlotLayerOptions.sizeMode


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

Defined in: map/plot.ts:29

PlotLayerOptions.stroke


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

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

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

PlotLayerOptions.tooltip