title: d3 Pie chart won't rerender
body: <p>I've got a pie chart and it will only draw once. I got it from <a href="http://bl.ocks.org/mbostock/3887235" rel="nofollow noreferrer">Mike Bostock's pie chart example</a>. I'm new to D3 and I can't figure out why it won't redraw. I saw <a href="https://stackoverflow.com/questions/15352201/d3-update-dataset-on-click-and-redraw-the-bar-chart">this</a> post about redrawing a bar chart, but for some reason that technique doesn't work on my pie chart. I'm sure I'm doing something wrong.</p>
  
  <pre><code>var width = 960,
      height = 500,
      radius = Math.min(width, height) / 2;
  
  var arc = d3.svg.arc()
      .outerRadius(radius - 10)
      .innerRadius(0);
  
  var pie = d3.layout.pie()
      .sort(null)
      .value(function(d) { return d.percent; });
  
  var svg = d3.select("body").append("svg")
      .attr("width", width)
      .attr("height", height)
    .append("g")
      .attr("transform", "translate(" + width / 2 + "," + height / 2 + ")");
  
  function drawChart(error, data) {
    console.log("here");
  
    data.forEach(function(d) {
      d.percent = +d.percent;
    });
  
    var g = svg.selectAll(".arc")
        .data(pie(data))
        .enter()
        .append("g")
        .attr("class", "arc");
  
    g.append("path")
        .attr("d", arc)
        .style("fill", function(d) { 
      console.log("inside path"); 
      return d.data.color;
    });
  
    g.append("text")
        .attr("transform", function(d) { console.log("inside transform", d);return "translate(" + arc.centroid(d) + ")"; })
        .attr("dy", ".35em")
        .style("text-anchor", "middle")
        .text(function(d) { return d.data.color; });
  
  }
  
  drawChart(undefined, [{"color": "green", "percent": 50}, {"color": "red", "percent": 50}]);
  
  setTimeout(function () {
    drawChart(undefined, [{"color": "green", "percent": 75}, {"color": "red", "percent": 25}]);
  }, 1000)
  </code></pre>
  
  <p><a href="http://jsbin.com/dosoda/1/edit?html,js,output" rel="nofollow noreferrer">here's the jsbin</a>.</p>