Skip to main content
100%

Responding to Resize

✓ Published222🌍 Public
CCurran Kelleher
Last edited Dec 29, 2019
Created on Aug 30, 2018
Forked from Face in d3

This example demonstrates how a visualization can dynamically respond to browser window resizing. It uses the CSS `clientWidth` and `clientHeight` properties to extract the current container size and applies these dimensions to an SVG element via the `attr` method. Two diagonal lines are drawn across the SVG to visually confirm the correct sizing, with a resize event listener triggering a full redraw. The code relies on D3 v5’s selection and data join patterns to update the line coordinates.

AI-generated description
MIT Licensed

Similar vizzes