All examples By author By category About

emeeks

Multi-Part Sankey

This sankey diagram of energy generation and consumption shows the total energy flow from 2010 to 2050, split into 5-year segments. 2010 is in grey, 2050 is in dark green, and each 5-year step between is in order between those. You can see, for instance, the decline in oil reserves over the 40 year period, and corresponding increase in oil imports.

This relies on a modification of the original d3.sankey to draw adjusted links. This version of d3.sankey also differs in that it draws links as areas rather than relying on stroke-width.

The sankey.adjustedLink function works like the regular sankey.link function but takes an additional adjustment and offset value. The adjustment is the percent value of the overall link, and the offset is the y-pixel offset of the link. In this case, those both correspond to the percent and order of the segments, but don't have to.

The sankey diagram itself is laid out using the parent links as you would normally use d3.sankey (in this case the total energy flow over the forty year span) and then the adjusted links are drawn afterward as appropriate.

Source: https://www.gov.uk/government/publications/2050-pathways-calculator-with-costs