title: Zoomable Treemap d3.v4
body: <p>I've extended the zoomable treemap implementation found <a href="http://bl.ocks.org/ganeshv/6a8e9ada3ab7f2d88022" rel="nofollow noreferrer">here</a> , but have hit some issues when trying to update it to work with d3 v4. My hierarchy is read in as a CSV of json objects. Each object is a course with a respective university and department.</p>
  
  <pre><code>var data = d3.nest().key(function(d) { return d.university; }).key(function(d) { return d.department; }).entries(res);
  
  var treemap = d3.treemap()
        .children(function(d, depth) { return depth ? null : d._children; })
        .sort(function(a, b) { return a.value - b.value; })
        .ratio(height / width * 0.5 * (1 + Math.sqrt(5)))
        .round(false);
  </code></pre>
  
  <p>But the v4 treemap object does not have children() or sort() functions. Other <a href="https://github.com/d3/d3-hierarchy#node_sum" rel="nofollow noreferrer">sources</a> suggest that sum() and sort() should be performed on the nodes themselves, but I can't reconcile this with the other changes to d3.</p>
  
  <p>Can someone please show me how to put my data in the treemap layout?</p>