block by HarryStevens baf7deb189131ad267198938ea9eb1e3

Sankey from CSV III

Full Screen

Create a Sankey diagram from a CSV file. I got most of this code from d3noob’s block, but I added the code to convert the CSV data into the format required by d3-sankey.

In this version, the links are colored as a linear gradient, transitioning from the color of the source to that of the target. In version 1, the links were not colored. In version 2, the links were colored according to this source.

My verdict: A single color is the easiest to read.

index.html

data.csv

sankey.js