🌍 Public
Viewing a saved revision (read-only)
645d24d6e2ea4d5a9e488ac972cab40d
Fork of Responding to Resize
This example demonstrates a full-window SVG that redraws an X shape whenever the browser viewport changes size. It uses a CSS-fixed `#chart` container to compute the available width and height via `clientWidth` and `clientHeight`, then updates the SVG’s `width` and `height` attributes inside a `redraw()` function. The code attaches a `window` `resize` event listener to call `redraw()` continuously, ensuring the two thick green lines always span the new dimensions. Built with D3 v5, it selects elements with `d3.select` and uses the `merge` method to update the line positions.
AI-generated description