Fork of Responding to Resize
✓ Published0🌍 Public
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 descriptionMIT Licensed