Skip to main content
100%

Brush & Zoom

✓ Published0🌍 Public
Mmbostock
Last edited Feb 19, 2020
Created on Jul 4, 2016

This example shows a focus and context view of the Standard & Poor’s 500 stock index over time, with a large area chart on the top and a smaller overview below. A colored brush in the context pane selects a date range, while a transparent rectangular overlay on the focus pane enables direct zooming and panning via the `d3.zoom` API; both interactions synchronize the visible data domain. The code combines `d3.brushX` with `d3.zoom`, and uses `d3.scaleTime`, `d3.axisBottom`, and `d3.area` to render the monthly price data from the CSV file as scalable vector graphics (SVG).

AI-generated description

Combining d3-brush and d3-zoom to implement Focus + Context. Another approach is to zoom to the brushed region.

gpl-3.0 Licensed

Similar vizzes