title: D3 add zoom to circle pack
body: <p>Is it possible to add zooming to a circle pack? Seems like it should be but mine is jumping all around the place when zoom is clicked. I've been attempting to solve this for a few days but with little success.</p>
  
  <p>I've been referencing Mike's Zoomable Circle Packing block (#7607535) and nilanjenator's block (#4950148). Other examples seem to be based on these two. Here's a fiddle of my work in progress: <a href="http://jsfiddle.net/cajmcmahon/9weovdm2/5/" rel="nofollow">http://jsfiddle.net/cajmcmahon/9weovdm2/5/</a>.</p>
  
  <p>From what I can make out, my layout problems lie in these two functions:</p>
  
  <pre><code>t.selectAll("circle")
          .attr("cx", function(d) {
              return x(d.x);
          })
          .attr("cy", function(d) {
              return y(d.y);
          })
          .attr("r", function(d) {
              return k * d.r;
          });
  
  t.selectAll("text")
          .attr("x", function(d) {
              return x(d.x);
          })
          .attr("y", function(d) {
              return y(d.y);
          })
          .style("opacity", function(d) { return k * d.r &gt; 20 ? 1 : 0; });
  </code></pre>
  
  <p>Also, I can't get the viz to reset (zoom out?) when I click on the background. I believe it's not getting values for 'data'...</p>
  
  <pre><code>//Reset when click on background
      d3.select(window).on("click", function(d, i) {
          zoom(data)
      });
  </code></pre>
  
  <p>Thanks for any help.</p>