Small Multiples
✓ Published0🌍 Public
Mmbostock
Last edited Feb 9, 2016
Created on Aug 19, 2011
This visualization shows monthly stock prices for multiple symbols as a grid of small multiples, with each chart displaying a time-series line and area fill for a single stock. The x-axis spans the common date range across all symbols, while the y-axis is independently scaled per chart to accommodate local price ranges. Built with D3 v3, the code loads CSV data via `d3.csv`, nests entries by symbol using `d3.nest`, and renders SVG paths using `d3.svg.area` and `d3.svg.line`.
AI-generated descriptionThis example shows a few interesting techniques with D3:
- Stock prices in CSV format are loaded asynchronously.
- Stock prices are nested by symbol.
- The x-scale is the minimum and maximum across symbols. (Note Google's IPO.)
- The y-scale is local to each symbol; the domain is set per multiple.
- Area and line shapes are used to fill and stroke separately.
Two alternative approaches to small multiples include using selection.each to create a scope and binding local scales to each multiple.
gpl-3.0 Licensed