A little thing to try to show how to make a top down collapsable tree map with d3 v4. It's not a great example and has a number of extraneous functions as I was messing around just trying to learn how to use this layout a little bit.
Mostly copied from: https://bl.ocks.org/d3noob/43a860bc0024792f8803bba8ca0d5ecd
But hopefully I'm going to hack it so show how to max and or min heapify an array of numerical data. But transitions in d3 are hard...
But for a great and maybe more useful viz that works and has a decent explanation of how to use a heap data structure check out http://www.benfrederickson.com/heap-visualization/
https://d3js.org/d3.v4.js