Back to D3

Radial links

docs/d3-shape/radial-link.md

7.9.01.3 KB
Original Source

Radial links

A radial link generator is like the Cartesian link generator except the x and y accessors are replaced with angle and radius accessors. Radial links are positioned relative to the origin; use a transform to change the origin.

linkRadial() {#linkRadial}

Source · Returns a new link generator with radial tangents. For example, to visualize links in a tree diagram rooted in the center of the display, you might say:

js
const link = d3.linkRadial()
    .angle((d) => d.x)
    .radius((d) => d.y);

linkRadial.angle(angle) {#linkRadial_angle}

Source · Equivalent to link.x, except the accessor returns the angle in radians, with 0 at -y (12 o’clock).

linkRadial.radius(radius) {#linkRadial_radius}

Source · Equivalent to link.y, except the accessor returns the radius: the distance from the origin.