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)

1270793a37ef49f79afbd3c00784f44e

Fork of Responding to Resize

0 stars0🌍 Public
Kkatreeder
Last edited Feb 4, 2021
Created on Feb 4, 2021

This example demonstrates how an SVG visualization can respond dynamically to browser resizing by reading the container’s computed CSS dimensions and applying them to the drawing. It renders a simple green X composed of two diagonal lines using `d3.select` and `data` binding, with the `redraw` function called on the `window` `resize` event. The chart container uses fixed positioning, and the SVG size is updated via the `attr` method based on `clientWidth` and `clientHeight`, ensuring the graphic always fills the page.

AI-generated description