title: Programatic zoom in D3
body: <p>Using the code pattern <a href="http://bl.ocks.org/mbostock/3680957" rel="nofollow">here</a>, I want to programmatically achieve semantic zooming (in or out).  I'm unsure how to get the proper x, y, and scaleExtent terms that are augmented via the zoom:</p>
  
  <pre><code>var svg = d3.select("body").append("svg")
      .attr("width", width)
      .attr("height", height)
    .append("g")
      .call(d3.behavior.zoom().x(x).y(y).scaleExtent([1, 8]).on("zoom", zoom));
  </code></pre>
  
  <p>See JSfiddle <a href="http://jsfiddle.net/u0moj7ez/" rel="nofollow">here</a>. The zoomIn and zoomOut functions should simulate the mousewheel events centered in the SVG.</p>
  
  <p>Here's a solution based on the answer below: <a href="http://jsbin.com/dociwuvacu/1" rel="nofollow">http://jsbin.com/dociwuvacu/1</a></p>