Fork of Responding to Resize
✓ Published0🌍 Public
This example demonstrates how a D3.js visualization can respond to browser resizing by redrawing an SVG element to fill the available screen space. It uses `d3.select` to append an SVG to a fixed-position div, then defines a `redraw` function that reads the container’s `clientWidth` and `clientHeight` to set the SVG’s dimensions. The visualization draws two diagonal lines forming a green X, with stroke opacity set via D3’s attribute and style methods. A `window.addEventListener("resize", redraw)` handler triggers the redraw on every viewport change.
AI-generated descriptionMIT Licensed