Skip to main content
100%

Fork of Responding to Resize

✓ Published0🌍 Public
CCristina Macaraig
Last edited Jul 17, 2021
Created on Jul 17, 2021

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

Similar vizzes