Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Responding to Resize

Public visualization

Viewing a saved revision (read-only)

5a55df565d444cbf9807f71349a6d5a6

Responding to Resize

0 stars0🌍 Public
Jjesramyep1263
Last edited Mar 20, 2020
Created on Mar 20, 2020

This example demonstrates an SVG visualization that fills the browser window and redraws its content whenever the window is resized. It shows a green X shape composed of two crossing lines, whose coordinates are recalculated to match the container's current dimensions. The code uses `d3.select` to append an SVG element and relies on CSS `position: fixed` with `clientWidth` and `clientHeight` to determine the size. Window resize events trigger the `redraw` function, which updates the SVG's width, height, and line positions using D3's `.attr` methods.

AI-generated description