Getting started with D3

The D3 API can take some getting used to. The examples in this chapter will strive to illustrate some of the basic concepts as well as dive deeper as we move forward to show some of the best that D3 has to offer. 

Before we can do any of that, you need to get D3 into your page. To do so, you can use npm to install it into your project folder:

npm install d3

Once you've got it installed, you can link to the minified D3 source from your document using a script tag:

<script src="node_modules/d3/dist/d3.min.js"></script>

If you'd prefer not to use npm, it's also available to be linked to from d3js.org directly:

<script src="https://d3js.org/d3.v5.js"></script>

Additionally, if you want a local copy, you can clone the project ...

Get Mastering SVG now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.