Skip to main content
100%

Zoomable Circles & Pan with D3-Zoom

✓ Published0🌍 Public
DDonald Bagwell
Last edited Sep 2, 2024
Created on Sep 2, 2024

This visualization demonstrates a zoomable and pannable SVG canvas containing six colored circles of varying sizes and positions. The example uses the `d3-zoom` library's `zoom` function, which is applied to the SVG element to handle mouse interactions. A `transform` state, updated via a zoom event callback, is applied to a group element containing all circles, allowing the entire set to be panned and scaled smoothly. The circle data, including x, y, radius, and fill color, is hardcoded in the JavaScript.

AI-generated description

A demonstration of how to add panning and zooming using d3-zoom.

Challenge

  • Use this technique to add zooming to a visualization you created, such as a map
MIT Licensed

Similar vizzes