Skip to main content
100%

Fork of Responding to Resize

✓ Published0🌍 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
MIT Licensed

Similar vizzes