🌍 Public
Viewing a saved revision (read-only)
1ce43b9a7b084ff385cb67973e19fc7d
Fork of Responding to Resize
This example demonstrates how an SVG visualization can automatically resize to fill its container. It renders two green, semi-transparent lines forming an X that spans the full width and height of the available space. The code uses d3.v5 to select the chart div and append an SVG element, then a `redraw()` function extracts `clientWidth` and `clientHeight` from the container to update the SVG’s dimensions and line coordinates. A window `resize` event listener triggers this function, ensuring the visualization always matches the browser’s viewport size.
AI-generated description