Skip to main content
100%

SANKEY Experiment

✓ Published0🌍 Public
Dd3noob
Last edited Sep 5, 2016
Created on Sep 5, 2016

A Sankey diagram visualizes the flow of "Widgets" between five named people, with link thickness proportional to transfer values. Built with D3 v4, it uses the `d3.sankey` plugin to compute node positions and link paths, rendering nodes as draggable SVG rectangles and links as cubic Bézier curves via `sankey.link()`. Data loads from a JSON file with named source and target references, which the code maps to node objects before layout. The scene updates interactively on drag, recalculating link depths through `sankey.relayout()`.

AI-generated description

The above example is intended to demonstrate drawing a simple Sankey diagram using JSON with names for the nodes instead of relying on d3 to index them. It uses Jason Davies' version of the Sankey plugin.

This is one of the code samples for the update to the book D3 Tips and Tricks to version 4 of d3.js.

Similar vizzes