🌍 Public
Viewing a saved revision (read-only)
3f526cef80f7496eb6770e46af95ec32
Fork of Responding to Resize
This example demonstrates how a D3.js visualization can automatically resize its SVG output to match the browser window’s dimensions. The code uses CSS to make a container div fill the viewport, then reads `clientWidth` and `clientHeight` to set the SVG’s width and height attributes. It draws an X shape using two green lines with heavy stroke width and opacity, showing the current size. The `redraw` function reapplies these dimensions whenever the window is resized by listening to the `resize` event.
AI-generated description