Small multiples
✓ Published0🌍 Public
CColinEberhardt
Last edited Aug 9, 2018
Created on Mar 8, 2017
This example shows monthly sales trends across five years as a grid of small multiples, with each chart displaying an area, line, and point series plus an average annotation. It is built with d3fc components, including `seriesSvgArea`, `seriesSvgLine`, `seriesSvgPoint`, `seriesSvgMulti`, and `chartSvgCartesian`, all rendered via a data-join on nested data from `d3.nest`. The charts are laid out using flexbox, and CSS media queries reduce chart height on narrower screens, while y-axes are hidden for repeated charts via opacity styling.
AI-generated descriptionThis is a re-implementation of this neat small mutliple example using d3fc components.
Some notable things ...
- The area, line and point series renderers remove some of the basic SVG rendering logic.
- The cartesian chart component is being rendered via a data-join to create the small multiples. Because the chart uses a mixture of SVG and DOM, we can hide the y axis for repeated charts using CSS.
- The responsive behaviour where the chart height is reduced for narrower screens uses a simple media query. This is made possible because the chart components uses the underlying d3fc element API which handles redrawing svg / canvas elements when their size changes.
mit Licensed