-
Book Overview & Buying
-
Table Of Contents
Learn D3.js - Second Edition
By :
This section introduces the D3 selection object – a fundamental concept in D3. A selection object, or simply selection, represents zero or more DOM elements that can be manipulated as a group. Binding data to a selection will synchronize it with the elements it represents, allowing you to add new elements, remove extra elements, and update them as necessary.
Selections are immutable objects, while elements are mutable and can be modified using methods. Most methods called on a selection return a selection. This allows selection operations to be chained together. Methods that alter attributes and styles and handle events return the same selection, while methods that append new elements, apply transitions, and bind and merge data return a new, modified selection.
Selections are used in all D3 visualizations. We have already used them in Chapters 1, 4, and 5. This section will explore them in detail.
Table 6.1 lists the top-level functions...