title: Wrapping text labels
body: <p>Currently trying to wrap some text labels on my graph. I'm following Mike Bostock's example <a href="http://bl.ocks.org/mbostock/7555321" rel="nofollow">here</a>. When I tried implementing his example it works for my y-axis but I need it to work on my x-axis and I'm not exactly sure why it's not working. </p>
  
  <pre><code> chart2.append("g")
          .attr("class", "y axis")
          .call(yAxis)
          .append("text")
          .attr("transform", "rotate(-90)")
          .attr("y", 6)
          .attr("dy", ".71em")
          .style("text-anchor", "end")
          .text("Potential Years Lost")
          .call(wrap, x0.rangeBand());
  
  
    function wrap(text, width) {
    text.each(function() {
      var text = d3.select(this),
          words = text.text().split(/\s+/).reverse(),
          word,
          line = [],
          lineNumber = 0,
          lineHeight = 1.1, // ems
          y = text.attr("y"),
          dy = parseFloat(text.attr("dy")),
          tspan = text.text(null).append("tspan").attr("x", 0).attr("y", y).attr("dy", dy + "em");
      while (word = words.pop()) {
        line.push(word);
        tspan.text(line.join(" "));
        if (tspan.node().getComputedTextLength() &gt; width) {
          line.pop();
          tspan.text(line.join(" "));
          line = [word];
          tspan = text.append("tspan").attr("x", 0).attr("y", y).attr("dy", ++lineNumber * lineHeight + dy + "em").text(word);
        }
      }
    });
  }
  
  function type(d) {
    d.value = +d.value;
    return d;
  }
  </code></pre>
  
  <p>Here's my fiddle: <a href="http://jsfiddle.net/flyingburrito/0xq0qc42/1/" rel="nofollow">http://jsfiddle.net/flyingburrito/0xq0qc42/1/</a></p>