LinkPath Transform
The linkpath transform is used to route a visual link between two nodes. The most common use case is to draw edges in a tree or network layout. By default links are simply straight lines between source and target nodes; however, with additional shape and orientation information, a variety of link paths can be expressed. This transform writes one property to each datum, providing an SVG path string for the link path.
Example
Transform Parameters
Property | Type | Description |
---|---|---|
sourceX | Field | The data field for the source x-coordinate. The default is source.x . |
sourceY | Field | The data field for the source y-coordinate. The default is source.y . |
targetX | Field | The data field for the target x-coordinate. The default is target.x . |
targetY | Field | The data field for the target y-coordinate. The default is target.y . |
orient | String | The orientation of the link path. One of vertical (default), horizontal or radial . If a radial orientation is specified, x and y coordinate parameters will instead be interpreted as an angle (in radians) and radius, respectively. |
shape | String | The shape of the link path. One of line (default), arc , curve , diagonal , or orthogonal . |
require | Signal | ≥ 4.3 A required signal that this transform depends on. This parameter is needed if source or target coordinate values are set as a non-propagating side-effect of a transform in a different data stream (such as a force transform). In such cases the upstream transform should be bound to a signal and required by the linkpath transform. |
as | String | The output field for the link path. The default is "path" . |
Usage
{"type": "linkpath"}
Computes straight-line link paths using the default source and target coordinate fields. Writes the result to the path
field.
{
"type": "linkpath",
"orient": "radial",
"sourceX": "source.angle",
"sourceY": "source.radius",
"targetX": "target.angle",
"targetY": "target.radius",
"shape": "orthogonal",
"as": "linkpath"
}
Computes link paths in polar coordinates ("orient": "radial"
) using the provided source and target coordinate fields. Link paths are routed along orthogonal
lines, as in a cluster plot or dendrogram. Writes the result to the linkpath
field.