Skip to main content
100%

Multiple Views in a Single SVG

✓ Published3🌍 Public
CCurran Kelleher
Last edited Apr 9, 2024
Created on Apr 1, 2024

This example shows how to place multiple visualizations side by side within a single SVG, comparing the same daily air temperature dataset across different chart types. The left half displays a multi-line chart where each year is a colored line, with 2024 highlighted in red and thicker, while the right half reuses the same rendering logic in a separate group translated horizontally. The code uses d3’s `scaleLinear`, `scaleSequential`, `flatGroup`, and `line` generators, along with `observeResize` from `@curran/responsive-axes` to handle responsive dimensions. Data comes from the `@curran/daily-surface-air-temperature` package, and colors are mapped via `interpolatePlasma`.

AI-generated description

A way of adding multiple visualizations to a single page.

MIT Licensed

Similar vizzes