Building a pie chart in d3.js always start by using the
d3.pie() function. This function transform the value of each group to a radius that will be displayed on the chart. This radius is then provided to the d3.arc() function that draws on arc per group.
How to use the centroid() function to add labels at the right position of each slice.
A selection of examples showing the application of the basic concept to real life dataset.