Skip to content

Instantly share code, notes, and snippets.

@davelandry
Last active August 22, 2016 15:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davelandry/a523b45768c2ca464363 to your computer and use it in GitHub Desktop.
Save davelandry/a523b45768c2ca464363 to your computer and use it in GitHub Desktop.
Simple Sankey

Sankey charts show the flows in and out of a focus data point.

Featured on D3plus.org

<!doctype html>
<meta charset="utf-8">
<script src="//d3plus.org/js/d3.js"></script>
<script src="//d3plus.org/js/d3plus.js"></script>
<div id="viz"></div>
<script>
var nodes = [
{"id": "alpha"},
{"id": "beta"},
{"id": "gamma"}
];
var edges = [
{"strength": 2, "source": 0, "target": 2},
{"strength": 1, "source": 1, "target": 2},
{"strength": 1, "source": 2, "target": 0},
{"strength": 3, "source": 2, "target": 1}
];
var visualization = d3plus.viz()
.container("#viz")
.edges({
"strength": "strength",
"value": edges
})
.focus({
"tooltip": false,
"value": "gamma"
})
.id("id")
.nodes(nodes)
.size(100)
.type("sankey")
.draw();
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment