SANKEY Experiment
A dynamic Sankey diagram visualizes the flow of values between five nodes using D3.js v5 and the Sankey plugin layout methods (`d3.sankey`, `sankey.layout`, and `sankey.link`). The SVG-based chart renders colored nodes and curved links with widths proportional to link values, supporting interactive node dragging via `d3.drag` to reposition elements and trigger `sankey.relayout()`. Data from a static JSON file defines node connections and quantitative weights, with hover tooltips showing source–target pairs and formatted widget counts. The example demonstrates custom link-path generation for a compact, explorable flow network.
AI-generated descriptionThe above example is intended to demonstrate drawing a simple Sankey diagram using v5 of d3.js. 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 5 of d3.js.