Skip to main content
100%

D3 V4 zoom with Axis explained

✓ Published0🌍 Public
FFrissAnalytics
Last edited Sep 4, 2018
Created on Sep 4, 2018

This example demonstrates an interactive zooming technique for scatterplot-style visualizations using D3.js version 4. A red SVG viewport contains a single circle and two axes, with a transparent rectangle serving as the zoom control surface. The implementation uses `d3.zoom()` to capture mouse interactions and applies the event's transform to rescale both the linear x and y axes via `rescaleX()` and `rescaleY()`. Axis updates are handled through `d3.axisBottom` and `d3.axisLeft`, while the data circle is repositioned using the same transform, creating a synchronized zoom effect without clipping.

AI-generated description

basic chart with zoom functionality. No clipping

https://bl.ocks.org/rutgerhofste/5bd5b06f7817f0ff3ba1daa64dee629d to see it in action

forked from <a href='http://bl.ocks.org/rutgerhofste/'>rutgerhofste</a>'s block: <a href='http://bl.ocks.org/rutgerhofste/5bd5b06f7817f0ff3ba1daa64dee629d'>D3 V4 zoom with Axis explained</a>

mit Licensed

Similar vizzes