Skip to main content
100%

Responding to Resize

✓ Published0🌍 Public
Llokkafufya
Last edited Dec 11, 2019
Created on Dec 11, 2019
Forked from HTML Starter

This example demonstrates how a visualization can adapt to browser resizing. It shows a blank SVG canvas that fills the entire viewport, with a hardcoded dataset of two resources awaiting rendering. On every window resize event, the code extracts the container’s dimensions using `clientWidth` and `clientHeight`, then updates the SVG’s `width` and `height` attributes accordingly. The implementation uses d3.js v5 for DOM selection and SVG creation, with pure JavaScript event listeners to trigger the redraw function.

AI-generated description

A bare minimum HTML page.

See also React Starter.

MIT Licensed

Similar vizzes