Getting Started
Setting up your environment and your first D3 project.
Getting Started
Ready to write your first line of D3? Let’s get your environment set up.
Installation
The easiest way to include D3 in your project is via NPM:
npm install d3
Or, if you just want to experiment in a single HTML file, you can load it from a CDN:
<script src="https://d3js.org/d3.v7.min.js"></script>
Your Initial Setup
In this course, we will heavily use the Live Playground. It’s pre-configured with D3 v7, so you don’t even need to install anything to follow along!
Basic Selection
The first step in any D3 project is selecting an element to work with:
// Select the body and change its background color
d3.select("body").style("background-color", "black");
🧠 Final Check for this Chapter
Let’s wrap up the introduction chapter with one last quiz.
Getting Started Quiz
-- / --