🌍 Public
Viewing a saved revision (read-only)
3481c1c5652f4282b04514e83b7914c7
Responding to Resize
This example demonstrates how a D3.js visualization can dynamically adjust to fit its container. It draws a large green X composed of two diagonal lines that stretch from corner to corner, with the SVG element’s width and height updated to match the chart div’s client dimensions. The code uses `d3.select` and `selection.attr` to resize the SVG, and a `window.addEventListener("resize", redraw)` function to trigger the redraw. The rendering approach is SVG, with the chart container styled via CSS to fill the entire viewport.
AI-generated description