🌍 Public
Viewing a saved revision (read-only)
65aae71acb2c4d6da16c80e2c2791230
Responding to Resize
This example demonstrates how a D3.js visualization can adapt to browser window resizing. A full-page SVG displays a green X composed of two thick lines that stretch to match the container’s current dimensions. The code uses a `redraw` function to read `clientWidth` and `clientHeight` from the chart’s `div`, then updates the SVG’s width and height attributes and the line coordinates via a data join. A native `window` `resize` event listener triggers a redraw whenever the viewport changes.
AI-generated description