🌍 Public
Viewing a saved revision (read-only)
4856fe570b654f3994dfee3e5d31644b
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