Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Fork of Responding to Resize

Public visualization

Viewing a saved revision (read-only)

5d531421b62a4a4a8c745593a004cad7

Fork of Responding to Resize

0 stars0🌍 Public
AAmandineM97
Last edited Apr 13, 2022
Created on Apr 13, 2022

A full-window SVG responds to browser resizing by redrawing an X-shape through two crossing lines. The `#chart` container uses fixed CSS positioning to fill the viewport, and a `resize` event listener calls a `redraw()` function that reads `clientWidth` and `clientHeight` to update the SVG dimensions. D3 v5 binds the line data to the selection, merging enter and update nodes to adjust coordinates, stroke-width, opacity, and green color. The example demonstrates a simple pattern for size-aware, responsive visualization.

AI-generated description