Skip to main content
100%

Fork of Responding to Resize

✓ Published0🌍 Public
AAbdulazizfh
Last edited Jan 27, 2021
Created on Jan 27, 2021

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
MIT Licensed

Similar vizzes