Path
When creating maps with D3, the path SVG tag is used most often. Using the definition from W3C, you can think of the path tag as a series of commands that explain how to draw any shape by moving a pen on a piece of paper. The path commands start with the location to place the pen and then a series of follow-up commands that tell the pen how to connect additional points with lines. The path shapes can also be filled or have their outline styled.
Let's look at a very simple example to replicate the triangle we created as a polygon.
Open your browser, go to http://localhost:8080/chapter-2/path.html, and you will see the following output on your screen:
Right-click anywhere in the triangle and select Inspect element.
The path command for ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access