DataLabelOptions
Defined in: map/base-engine.ts:141
Engine-owned text labels for plot() / geoMap() (#223) — the data-driven analogue of
network.labels(). You supply the data and d3-style accessors; the engine measures each label’s
text once (no magic-number metrics), places + culls collisions on every pan/zoom (the shared
LabelLayer machinery), and routes to the active backend — an HTML overlay on WebGL, native
<text>/fillText on SVG/Canvas so labels survive toSVG()/toPNG() export. Styling mirrors
network.labels(): a built-in default look, an inline style override, or a full-CSS
className. Plain labels are vertically centred on the anchor (offset sits them beside the
glyph); set rotationOf for the oriented (rotated) model.
Type Parameters
Section titled “Type Parameters”D = unknown
Properties
Section titled “Properties”anchorOf
Section titled “anchorOf”anchorOf: (
d,i) => [number,number] |null|undefined
Defined in: map/base-engine.ts:146
The label’s REFERENCE (world / pre-transform) anchor [x, y]; null/undefined skips it.
For geoMap this is a projected point (e.g. projection(feature.geometry.coordinates)).
Parameters
Section titled “Parameters”D
number
Returns
Section titled “Returns”[number, number] | null | undefined
className?
Section titled “className?”
optionalclassName?:string
Defined in: map/base-engine.ts:166
Advanced overlay styling: a CSS class that SKIPS the built-in default so the class’s CSS has full control (combine with style for inline overrides).
color?
Section titled “color?”
optionalcolor?:string
Defined in: map/base-engine.ts:171
Fill colour for backend-native text. Defaults to style’s colour, then the default.
optionalfont?:string
Defined in: map/base-engine.ts:169
Font for backend-native text (SVG/Canvas, incl. export). Defaults to style’s font, then the built-in default. Also the font used to MEASURE label boxes.
optionalhalo?:object
Defined in: map/base-engine.ts:174
Legibility halo stroked behind backend-native text. Defaults to the built-in white halo unless
style sets textShadow: "none".
color:
string
width:
number
importanceOf?
Section titled “importanceOf?”
optionalimportanceOf?: (d,i) =>number
Defined in: map/base-engine.ts:148
Importance for collision priority and, when max caps, ranking (higher wins). Default 0.
Parameters
Section titled “Parameters”D
number
Returns
Section titled “Returns”number
keepUpright?
Section titled “keepUpright?”
optionalkeepUpright?:boolean
Defined in: map/base-engine.ts:157
Oriented labels only: flip 180° to keep text upright (radial-tree readability flip).
labelOf
Section titled “labelOf”labelOf: (
d,i) =>string|null|undefined
Defined in: map/base-engine.ts:143
The label text for a datum, or null/"" to skip it (no label for that datum).
Parameters
Section titled “Parameters”D
number
Returns
Section titled “Returns”string | null | undefined
optionalmax?:number
Defined in: map/base-engine.ts:159
Cap the number of shown labels to the top-k by importance (default: no cap — collision thins).
offset?
Section titled “offset?”
optionaloffset?: [number,number] | ((d,i) => [number,number])
Defined in: map/base-engine.ts:150
Constant screen-px offset [dx, dy] from the anchor, or a per-datum accessor. Default [0, 0].
rotationOf?
Section titled “rotationOf?”
optionalrotationOf?: (d,i) =>number
Defined in: map/base-engine.ts:153
Oriented labels: reading-direction angle (radians) per datum — switches to the rotated collision/render model (text runs along the axis, vertically centred on the anchor).
Parameters
Section titled “Parameters”D
number
Returns
Section titled “Returns”number
style?
Section titled “style?”
optionalstyle?:LabelStyle
Defined in: map/base-engine.ts:163
Inline overlay CSS (camelCased property → value), merged over the built-in default label look
(a dark 11px sans-serif with a white halo) — a partial override like { color: "#333" } keeps
the rest. Applied once per element at creation, never per frame.
textAnchor?
Section titled “textAnchor?”
optionaltextAnchor?:TextAnchor
Defined in: map/base-engine.ts:155
Oriented labels only: which way text runs from the anchor (default "start").