🌍 Public
Viewing a saved revision (read-only)
38a7f7dff4b64e519059b3711a6baf01
Responding to Resize
This example demonstrates how a D3.js visualization can respond to browser window resizing. A green X is drawn across the full viewport, with its lines recalculated to match the current window dimensions. The code uses the `clientWidth` and `clientHeight` properties of a div container to set the SVG element's width and height attributes. A `redraw` function is invoked on the `resize` event, regenerating the line positions with a data join using `selectAll` and `merge`.
AI-generated description