SANKEY Experiment
This example demonstrates an interactive Sankey diagram with draggable nodes using d3.js v5. The visualization shows flow relationships between five nodes with seven weighted links, rendered as SVG paths and rectangles. The code loads data from a JSON file via d3.json, applies the d3.sankey plugin for layout computation, and uses d3.drag to enable node repositioning. A relayout function recalculates link paths dynamically when nodes are dragged. The diagram uses color from d3.scaleOrdinal and formats values as "Widgets" units.
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 particular version allows the dragging of nodes in the x and y direction. Have a play!
This is one of the code samples for the update to the book D3 Tips and Tricks to version 5 of d3.js.