-
Book Overview & Buying
-
Table Of Contents
Learn D3.js - Second Edition
By :
This section introduces basic drag & drop techniques through simple examples focused on the mechanism provided by D3 and its configuration.
Dragging and dropping enhances data visualizations by allowing users to grab, move, and release objects. It’s useful for dense visualizations like network graphs, where users can customize their view. It also supports exploratory interactivity, allowing the user to move data points.
JavaScript and HTML have a built-in drag-and-drop functionality for data transfer, but it doesn’t support SVG or Canvas. Implementing lower-level solutions with pointer events is complex, as it requires handling device-specific events and dealing with each stage in the drag-and-drop process. D3 simplifies this by providing functions to easily drag objects in SVG or Canvas.
A drag behavior is set up by calling d3.drag() with at least one event handler. In the previous section...