-
Book Overview & Buying
-
Table Of Contents
Learn D3.js - Second Edition
By :
D3 comes with three modules that provide higher-order abstractions for complex multi-stage interactive behaviors. They are:
d3.drag(): for dragging and dropping elementsd3.brush(), d3.brushX() and d3.brushY(): for selecting areas and ranges in a chartd3.zoom(): for zooming and panningImplementing these behaviors with native JavaScript or selection.on() is complex, as it requires keeping track of multiple events and their states. These modules provide high-level semantic listeners and event types that transparently register native listeners and manage low-level events, making it much easier to add them to your data visualizations.
Table 14.3 describes the five factories used to set up a behavior object, the event types each one listens to, the on() method used to set up listeners for each event type, and the main properties you can manipulate from the event objects received by the listeners.