A modified implementation of Cascaded Treemaps. With respect to the original algorithm, this implementation has a better (in my opinion) cascading effect, which ensures no zig-zag behaviors in corners.
Unfortunately, this method introduces a very ugly layout error (visible on the bottom right corner, where an elongated rectangle is displayed as outside its parent container). A possible solution would be to reintroduce the same fix described in the paper linked above, but this would also reintroduce the zig-zag behavior in such corner cases.
xxxxxxxxxx
<html>
<head>
<meta charset="utf-8">
<title>Cascaded treemaps</title>
<link type="text/css" href="index.css" rel="stylesheet"/>
<script src="https://d3js.org/d3.v3.min.js"></script>
</head>
<body>
<svg></svg>
<script src="index.js"></script>
</body>
</html>
Modified http://d3js.org/d3.v3.min.js to a secure url
https://d3js.org/d3.v3.min.js