Pan & Zoom Axes
This example demonstrates interactive pan and zoom control over a two-dimensional plot. Using the d3-zoom library, a user can drag to pan and scroll to zoom, with the view constantly updated. The code applies the zoom transform to linear scales via `rescaleX` and `rescaleY`, which then redraws the axes and a colored rectangle backdrop. The rectangle uses an SVG linear gradient, and a reset button animates the view back to its original state with a D3 transition.
AI-generated descriptionThis example demonstrates using d3-zoom to drive changes to scales’ domains via transform.rescaleX and transform.rescaleY. The transformed scales are used to draw axes. The transform is also applied via SVG transform to the colorful rainbow rect. (The colors are from Nadieh Bremer’s lovely SVG gradient tutorial.)
forked from <a href='http://bl.ocks.org/mbostock/'>mbostock</a>'s block: <a href='http://bl.ocks.org/mbostock/db6b4335bf1662b413e7968910104f0f'>Pan & Zoom Axes</a>