title: D3: how to rescale the pack layout to fit only visible circles?
body: <p>I have a pack layout with multiple levels (depths), out of which a few first ones are made not visible (just like in the example: <a href="http://bl.ocks.org/mbostock/4063269" rel="nofollow noreferrer">http://bl.ocks.org/mbostock/4063269</a>:</p>
  
  <p><img src="https://i.stack.imgur.com/8CEgT.png" alt="enter image description here"></p>
  
  <p>... where the root node is hidden).</p>
  
  <p>However, the scaling works by fitting ALL the circles in an svg container, not only the visible ones. This leads to lost space if a few top-cirles are made invisible...</p>
  
  <p>What would be a good way to rescale the layout to fit only the visible circles in the container? I thought about checking all nodes for extreme x/y coordinates and rescaling based on that...</p>