This example shows how to split a rectangle into a stack using d3.layout.stack. This is example 12 from the screencast Splitting Charts.
MIT License
https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js
https://cdnjs.cloudflare.com/ajax/libs/d3-legend/1.5.0/d3-legend.js