d3.js selection frame example
✓ Published0🌍 Public
JJosephSKh
Last edited Jun 29, 2017
Created on Jun 29, 2017
This example demonstrates interactive rubber-band selection in an SVG canvas using D3.js v3. It shows how users can drag to draw a rectangular selection frame over a set of labeled circles, with the selection rectangle dynamically resizing to accommodate drags in any direction. The code uses D3’s `mousedown`, `mousemove`, and `mouseup` events on the SVG element, appending a `rect` with the `.selection` class and updating its position and dimensions via `d3.mouse`. The circles, defined in a static JavaScript array, highlight on mouseover and clear the selection on release.
AI-generated descriptionBuilt with blockbuilder.org
mit Licensed