Skip to main content
100%

SANKEY Experiment

✓ Published0🌍 Public
Dd3noob
Last edited Dec 5, 2020
Created on Dec 5, 2020

A small Sankey diagram visualizes energy-style flows between five named people, with links and node values drawn as proportional colored bars and connecting paths. The example demonstrates loading graph data from a JSON file where node and link references use names instead of numeric indices, requiring a lookup map to connect sources and targets. Built with D3 v6 and the d3-sankey module, it renders to SVG using `d3.sankey`, `d3.sankeyLinkHorizontal`, and `d3.scaleOrdinal` for node coloring, with hover tooltips via `title` elements.

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.

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

mit Licensed

Similar vizzes