This post describes how to build a very basic pie chart with d3.js. You can see many other examples in the pie chart section of the gallery. Watch out: pie chart is most of the time a very bad way to convey information as explained in this post. This example works with d3.js v4
and v6
pie()
function. It takes this input and return the coordinates of each part of the pie.a:9
becomes index:0 / padAngle:0 / startAngle: 0 / endAngle: 0.71
d3.arc()
helper that will draw the shape.