title: D3 labels issue in zoomable scatter plot
body: <p>Here is the <a href="https://jsfiddle.net/hzey9yv8/" rel="nofollow noreferrer">problem</a> I got. When you drag or zoom in, the labels are not moving </p>
  
  <p>The error:</p>
  
  <blockquote>
    <p>Uncaught TypeError: Cannot read property 'x' of undefined</p>
  </blockquote>
  
  <p>which corresponds to the last line.</p>
  
  <pre><code>  function zoom() {
      svg.select(".x.axis").call(xAxis);
      svg.select(".y.axis").call(yAxis);
  
      svg.selectAll(".dot")
          .attr("transform", transform);
  
      svg.selectAll("text")
          .attr("transform", transform);
    }
  
    function transform(d) {
      return "translate(" + x(d.x) + "," + y(d.y) + ")";
    }
  </code></pre>