Skip to main content
100%

Fork of Responding to Resize

✓ Published0🌍 Public
GGuan
Last edited Sep 13, 2024
Created on Sep 13, 2024

This example shows an SVG that dynamically resizes to fill the browser window, drawing a green X that spans the full width and height. The code uses a fixed-position `#chart` div and reads its `clientWidth` and `clientHeight` to set the SVG’s attributes on every resize. It leverages d3.v5’s data join with `selectAll`, `enter`, and `merge` to update two `line` elements, and listens to the window’s `resize` event to trigger a redraw. The rendering is purely SVG with no external data source.

AI-generated description
MIT Licensed

Similar vizzes