🌍 Public
Viewing a saved revision (read-only)
5977f5cb260c41a0b60d0a72798e7acf
Responding to Resize
This example demonstrates an SVG chart that automatically adjusts its size to fill the browser window, drawing a simple green X to visually confirm the layout. It uses D3 v5 to select the container div and append an SVG element, then defines a `redraw` function that reads the container’s `clientWidth` and `clientHeight` to set the SVG’s width and height attributes. A resize event listener triggers `redraw` on every window size change, while `selectAll` and data joins update the two diagonal line elements.
AI-generated description