Sankey Gradients
A Sankey diagram visualizes patient flow from referral through surgery, with links colored by gradients that blend the colors of their source and target nodes. The diagram is built using D3.js and a custom `d3.sankey` module, which handles node positioning and link layout. The SVG rendering defines unique linear gradients for each link, created via the `defs` element, with colors derived from a categorical scale. The chart is interactive, allowing nodes to be dragged, which triggers a relayout of the links.
AI-generated descriptionhere all of the link path gradients render 😀
sankey
.nodes(graph.nodes)
.links(graph.links)
.layout(13); // any value > 13 breaks the link gradient
an iteration on by Patient Flow Sankey Particles from @micahstubbs
see also the broken version with 14 layout iterations
inspired by the blog post Data-based and unique gradients for visualizations with d3.js and associated example Data based gradients - Simple - Solar system from @nadiehbremer
forked from <a href='http://bl.ocks.org/micahstubbs/'>micahstubbs</a>'s block: <a href='http://bl.ocks.org/micahstubbs/3c0cb0c0de021e0d9653032784c035e9'>Sankey Gradients</a>