5. Data-Joins: Enter

Data-joins are the bread and butter of D3. If you take one thing away from this book, make it understanding how data-joins work and how to use them. Remember that D3 has no basic function for producing charts. Instead, it uses data-joins. This chapter covers how to use data-joins to add elements to a webpage and then manipulate them with data.

What Are Data-Joins?

As the name suggests, data-joins involve joining data with something. That something is an element or a number of elements on a web page—<rect>s, <circles>s, <div>s... all the usual suspects. More specifically, that something is a D3 selection of those elements.

Before we get into all of that, let’s take a few steps back. Forget about D3 for a second. Now, imagine ...

Get Visual Storytelling with D3: An Introduction to Data Visualization in JavaScript™ 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.