🌍 Public
Viewing a saved revision (read-only)
74d80dc2cfed4611aebc2e3f8c6bf3b3
Fork of Responding to Resize
This example demonstrates a full-page SVG that dynamically resizes to match its container. It uses D3 v5 to select the chart div and append an SVG element, then defines a redraw function which extracts the container’s CSS-computed `clientWidth` and `clientHeight` to set the SVG’s attributes. A green diagonal cross is drawn with `selectAll` and data-bound `line` elements, merging enter and update selections. The function runs initially and listens for the browser `window` `resize` event, redrawing the graphic to fill the viewport.
AI-generated description