In order to start using D3, you will need the D3.js library in your webpage, which you can add through three different methods; Including D3 in your project folder, using npm, or from CDN. All three approaches are covered below.
Including D3.js Library from Project Folder
Since D3.js is an open source library, you can go to the official website and download the latest version, which is currently 6.5.0 at the time of this writing.
Once you download and open the zip file, you can copy the d3.v6.min.js ( minified version) file into your project folder and include the file in your HTML page using a script tags.
Using Node Package Manager
If you use npm, then you can install d3 by going to your terminal and using the npm install d3 command. Once you have entered the command, you can load the library in a script tag.
For minimized version:
Including D3.js Library from CDN
Content Delivery Network (CDN) is a network of servers that host files, so by using this method, you don’t need to download the source code. You can include the library by using this CDN URL:
<script src = "https://d3js.org/d3.v6.min.js"></script>
And there you have it, the three primary ways of installing the D3 library. In a future blog post I’ll cover how to use D3 in your editor. Thanks for reading!