block by vicapow 7061987

the simplest pie chart example

Full Screen

index.html

<!DOCTYPE html>
<html>
  <body>
    <script src="//d3js.org/d3.v3.min.js" charset="utf-8"></script>
    <script>
var vis = d3.select('body').append('svg').append('g')
    .attr('transform', 'translate(200,200)')
  , color = d3.scale.category10()
  , arc = d3.svg.arc().outerRadius(100).innerRadius(0)
  , pie = d3.layout.pie()
  , arcs = vis.selectAll('path').data(pie([4,5,6]))
    .enter().append('path').attr({ 
      d: arc, fill: function(d, i){ return color(i) }, stroke: 'white' })
    </script>
  </body>
</html>