Using an arc generator
Among the most common shape generators-besides the line and area generator-D3 also provides the arc generator. At this point, you might be wondering, Didn't SVG standard already include circle element? Isn't that enough?
The simple answer to this is no. The D3 arc generator is a lot more versatile than the simple svg:circle
element. The D3 arc generator is capable of creating not only circles but also annulus (donut), circular sector, and annulus sector, all of which we will learn in this recipe. More importantly, an arc generator is designed to generate, as its name suggests, an arc (in others words, not a full circle or even a sector but rather arcs of arbitrary angle).
Getting ready
Open your local copy of the following file in your web browser:
https://github.com/NickQiZhu/d3-cookbook-v2/blob/master/src/chapter7/arc.html
How to do it...
In this recipe, we will use arc generator to generate multi-slice circle, annulus (donut), circular sectors, and annulus sectors...