SVG parser reference
Functions
- findBars(svg, axes_class) ⇒
d3.Selection Find bar elements (
patchgroups with clipping) inside a given axes.- findPoints(svg, axes_class, tooltip_groups) ⇒
d3.Selection Find scatter plot points inside a given axes. Handles both
<use>and<path>fallback cases, and assignsdata-groupattributes based on tooltip groups.- findLines(svg, axes_class) ⇒
d3.Selection Find line elements (
line2dpaths) inside a given axes, excluding axis grid lines.- findAreas(svg, axes_class) ⇒
d3.Selection Find filled area elements (
FillBetweenPolyCollectionpaths) inside a given axes.- nearestElementFromMouse(mouseX, mouseY, elements) ⇒
Element|null Compute the nearest element to the mouse cursor from a set of elements. Uses bounding box centers for distance. This function is used when the
hover_nearestargument is true.- setHoverEffect(plot_element, axes_class, tooltip_labels, tooltip_groups, show_tooltip, hover_nearest)
Attach hover interaction and tooltip display to plot elements. Can highlight nearest element (if enabled) or hovered element directly.
findBars(svg, axes_class) ⇒ d3.Selection
Find bar elements (patch groups with clipping) inside a given axes.
Kind: global function
Returns: d3.Selection - D3 selection of bar elements.
| Param | Type | Description |
|---|---|---|
| svg | d3.Selection |
D3 selection of the SVG element. |
| axes_class | string |
ID of the axes group (e.g. "axes_1"). |
findPoints(svg, axes_class, tooltip_groups) ⇒ d3.Selection
Find scatter plot points inside a given axes.
Handles both <use> and <path> fallback cases,
and assigns data-group attributes based on tooltip groups.
Kind: global function
Returns: d3.Selection - D3 selection of point elements.
| Param | Type | Description |
|---|---|---|
| svg | d3.Selection |
D3 selection of the SVG element. |
| axes_class | string |
ID of the axes group (e.g. "axes_1"). |
| tooltip_groups | Array.<string> |
Group identifiers for tooltips, parallel to points. |
findLines(svg, axes_class) ⇒ d3.Selection
Find line elements (line2d paths) inside a given axes,
excluding axis grid lines.
Kind: global function
Returns: d3.Selection - D3 selection of line elements.
| Param | Type | Description |
|---|---|---|
| svg | d3.Selection |
D3 selection of the SVG element. |
| axes_class | string |
ID of the axes group. |
findAreas(svg, axes_class) ⇒ d3.Selection
Find filled area elements (FillBetweenPolyCollection paths) inside a given axes.
Kind: global function
Returns: d3.Selection - D3 selection of area elements.
| Param | Type | Description |
|---|---|---|
| svg | d3.Selection |
D3 selection of the SVG element. |
| axes_class | string |
ID of the axes group. |
nearestElementFromMouse(mouseX, mouseY, elements) ⇒ Element | null
Compute the nearest element to the mouse cursor from a set of elements.
Uses bounding box centers for distance.
This function is used when the hover_nearest argument is true.
Kind: global function
Returns: Element | null - The nearest DOM element or null.
| Param | Type | Description |
|---|---|---|
| mouseX | number |
X coordinate of the mouse relative to SVG. |
| mouseY | number |
Y coordinate of the mouse relative to SVG. |
| elements | d3.Selection |
Selection of candidate elements. |
setHoverEffect(plot_element, axes_class, tooltip_labels, tooltip_groups, show_tooltip, hover_nearest)
Attach hover interaction and tooltip display to plot elements. Can highlight nearest element (if enabled) or hovered element directly.
Kind: global function
| Param | Type | Description |
|---|---|---|
| plot_element | d3.Selection |
Selection of plot elements (points, lines, etc.). |
| axes_class | string |
ID of the axes group. |
| tooltip_labels | Array.<string> |
Tooltip labels for each element. |
| tooltip_groups | Array.<string> |
Group identifiers for each element. |
| show_tooltip | "block" | "none" |
Whether to display tooltips. |
| hover_nearest | boolean |
If true, highlight nearest element instead of hovered one. |