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 ...

Get Data Visualization with D3 4.x Cookbook - Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.