Scatterplot Pills
This example shows the monthly price of the S&P 500 index from 2000 to 2010 as elongated, semi-transparent "pill" markers in a focus-plus-context scatter plot. Users can brush a time range in the lower context panel, which triggers a callback to zoom the upper focus panel into that selection. Built with d3.v4, the code uses `d3.scaleTime`, `d3.scaleLinear`, `d3.brushX`, and `d3.axisBottom` to render both axes and the brush interaction. Data is loaded from a local `sp500.csv` file and drawn as SVG rectangles in the focus view and circles in the context view.
AI-generated descriptionExample of a scatter plot with brush using d3.js v4.
Tutorial at http://www.rajvansia.com/scatterplotbrush-d3-v4.html
Adapted from https://bl.ocks.org/mbostock/34f08d5e11952a80609169b7917d4172
forked from <a href='http://bl.ocks.org/rajvansia/'>rajvansia</a>'s block: <a href='http://bl.ocks.org/rajvansia/ce6903fad978d20773c41ee34bf6735c'>Scatterplot with brush d3 v4</a>