title: Preventing Text-Clipping in D3 (Javascript Charting)
body: <p>I'm drawing a pie chart in D3, but having trouble with the text clipping itself:</p>
  
  <p><img src="https://i.stack.imgur.com/G7kIC.png" alt="enter image description here"></p>
  
  <p>Here's my draw function:</p>
  
  <pre><code>    pie: function(config)
      {
          var width = config.width || 840,
              height = config.height || 520,
              radius = Math.min(width, height) / 2;
  
          var color = this._color = d3.scale.ordinal().range(["#98abc5", "#8a89a6", "#7b6888", "#6b486b", "#a05d56", "#d0743c", "#ff8c00"]);
          var arc = d3.svg.arc().outerRadius(radius - 10).innerRadius(0);
          var pie = d3.layout.pie().sort(null).value(function(d) { return d.value; });
  
          var svg = d3.select("body").append("svg").attr('id', config.id || 'chart').attr("width", width).attr("height", height)
                      .append("g").attr("transform", "translate(" + width / 2 + "," + height / 2 + ")");
  
            var g = svg.selectAll(".arc").data(pie(config.data)).enter().append("g").attr("class", "arc");
            g.append("path").attr("d", arc).style("fill", function(d) { return color(d.data.name); });
  
            g.append("text")
                .attr("transform", function(d) { return "translate(" + arc.centroid(d) + ")"; })
                .attr("dy", ".35em")
                .style("text-anchor", "middle")
                .text(function(d) { return d.data.name; });
          return $('#'+(config.id || 'chart'));
      },
  </code></pre>
  
  <p>Is there an easy way to prevent such text clipping?</p>