🌍 Public
Viewing a saved revision (read-only)
400d6e813a494f82a285e89a56526b31
Responding to Resize
This example shows how a visualization can adapt to browser window resizing by drawing a green X that spans the full width and height of the available space. The chart container uses CSS to fill the viewport, and a `resize` event listener triggers a `redraw` function that reads `chartDiv.clientWidth` and `clientHeight` to set the SVG’s dimensions. D3 v5’s data join (`selectAll`, `enter`, `merge`) updates the two line elements with new coordinates on every resize. The rendering uses SVG lines with a semi-transparent stroke.
AI-generated description