d3-simple-sankey
v0.1.1
Published
Reusable Sankey graph visualization using d3.js
Downloads
3
Readme
d3-simple-sankey
Reusable Sankey graph visualization using d3.js.
This is a very simple wrapper around http://bl.ocks.org/d3noob/5028304.
Deprecation
In d3 >=4.0, you should use mbostock own d3-sankey plugin here https://github.com/d3/d3-sankey.
Installation
You can install d3-simple-sankey using npm
:
npm install d3-simple-sankey
For Bower users, even if Bower is not officially supported, you can still use GitHub URL such as:
{
"dependencies": {
"eventDrops": "cerisier/d3-simpe-sankey#0.1.0"
}
}
Usage
Include the dist/d3.sankey.min.js
script in your page after d3:
<script src="path/to/d3.js"></script>
<script src="src/d3.sankey.min.js"></script>
In the HTML source, create a new Sankey chart, bind data to a DOM element, then call the chart on the element.
var chart = d3.chart.sankey();
d3.select('svg#chart')
.datum(data)
.call(chart);
See for the required data format.
Data example coming soon...
License
MIT