Fork of Responding to Resize
✓ Published0🌍 Public
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 descriptionMIT Licensed