🌍 Public
Viewing a saved revision (read-only)
f2fe596a1c9b4516ace8107c82ac9a0d
Responding to Resize
This example demonstrates how a D3.js v5 visualization can respond dynamically to browser window resizing. It uses a full-screen chart container and redraws an SVG element to match the container’s current pixel dimensions, displaying a green X composed of two thick lines. The code leverages `d3.select`, `svg.attr`, and a window `resize` event listener to update the drawing. The visualization extracts dimensions via `clientWidth` and `clientHeight`, ensuring the SVG scales proportionally with the viewport.
AI-generated description