🌍 Public
Fork of Responding to Resize
This example demonstrates a responsive SVG visualization that draws a green X spanning the full browser window. The chart container fills the page via CSS, and a `redraw()` function extracts the container’s `clientWidth` and `clientHeight` to set the SVG’s dimensions and position its two lines. Using D3 v5’s selection API (`d3.select`, `.append`, `.merge`), the code updates line coordinates and stroke properties on every window `resize` event, ensuring the graphic always matches the viewport.
AI-generated descriptionMIT Licensed
Comments
Sign in to join the discussion.