Skip to main content
100%

SANKEY Experiment

✓ Published0🌍 Public
Dd3noob
Last edited Nov 27, 2019
Created on Nov 27, 2019

This example shows a small Sankey diagram with five nodes and seven links, visualizing the flow of “Widgets” between process stages. The diagram updates live as the user drags nodes, re-layouting the links to match new positions. The code uses D3 v5 with a custom `d3.sankey` layout function, drawing the diagram as SVG paths and rectangles. It sets node width, padding, and link stroke opacity, and colors nodes with `d3.scaleOrdinal` and `d3.schemeCategory10`. The layout is computed with `sankey.layout(32)` iterations, and drag behavior uses `d3.drag`. Data loads from `sankey.json` via `d3.json`.

AI-generated description

The 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.

forked from <a href='http://bl.ocks.org/d3noob/'>d3noob</a>'s block: <a href='http://bl.ocks.org/d3noob/5ba21a90a721cb19a47ff14c9513e43a'>Sankey Diagram with v5</a>

mit Licensed

Similar vizzes