🌍 Public
Viewing a saved revision (read-only)
200545c4cf934a8aa8ee1e6cac08ccd9
Responding to Resize
This example demonstrates how a visualization can adapt to browser window resizing by drawing a green X that fills the entire viewport. The chart container is styled with CSS to occupy the full page, and a `resize` event listener triggers the `redraw` function whenever the window dimensions change. The function retrieves the computed `clientWidth` and `clientHeight` from the container, sets those values on the SVG element, and updates the line positions accordingly. The code uses D3 v5 selections with `merge` to update the two diagonal lines efficiently.
AI-generated description