Simple Sankey Diagram

Given an Array of nodes and an Array of links, d3plus-network can create a Sankey visualization using the Sankey class.

var nodes = [
  {id: "alpha"},
  {id: "beta"},
  {id: "gamma"},
  {id: "epsilon"},
  {id: "zeta"},
  {id: "theta"}
];

The source and target keys in each link need to be String values matching the id of the associated node.

var links = [
  {source: "alpha", target: "beta"},
  {source: "alpha", target: "gamma"},
  {source: "epsilon", target: "zeta"},
  {source: "epsilon", target: "theta"},
  {source: "theta", target: "alpha"}
];

Finally, these 2 variables simply need to be passed to a new Sankey class:

new d3plus.Sankey()
  .links(links)
  .nodes(nodes)
  .render();