This post describes how to build a very basic Sankey diagram with d3.js. You can see many other examples in the Sankey diagram section of the gallery. Learn more about the theory of Sankeys in data-to-viz.com.
nodes (feature of each elements) and links (how elements are connected)