Chapter 2. A Primer on DOM, SVG, and CSS

In this chapter, we'll take a look at the core technologies that make D3 tick, and they are as follows:

  • Document Object Model (DOM)
  • Scalable Vector Graphics (SVG)
  • Cascading Style Sheets (CSS)

You're probably used to manipulating DOM and CSS with libraries such as jQuery or MooTools, but D3 has a full suite of manipulation tools as well.

SVG is at the core of building truly great visualizations, so we'll take special care to understand it—everything from manually drawing shapes to transformations and path generators.


The Document Object Model (DOM) is a language-agnostic model for representing structured documents built in HTML, XML, or similar standards. You can think of it as a tree of nodes that closely ...

Get Data Visualization: Representing Information on Modern Web now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.