Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Responding to Resize

Public visualization

Viewing a saved revision (read-only)

5977f5cb260c41a0b60d0a72798e7acf

Responding to Resize

0 stars0🌍 Public
Sstelson
Last edited Apr 27, 2020
Created on Apr 27, 2020

This example demonstrates an SVG chart that automatically adjusts its size to fill the browser window, drawing a simple green X to visually confirm the layout. It uses D3 v5 to select the container div and append an SVG element, then defines a `redraw` function that reads the container’s `clientWidth` and `clientHeight` to set the SVG’s width and height attributes. A resize event listener triggers `redraw` on every window size change, while `selectAll` and data joins update the two diagonal line elements.

AI-generated description