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)

c7168a750a1645a0b86818ff2623837a

Fork of Responding to Resize

0 stars0🌍 Public
NNeil
Last edited Sep 18, 2021
Created on Sep 18, 2021

This example shows a green X drawn across the browser’s full viewport, with the lines re-rendering to match the window’s current size whenever the window is resized. It uses an SVG element whose width and height are set from the CSS-computed dimensions of a fixed-position container. The code appends two `<line>` elements with `d3.select` and uses a custom `redraw()` function attached to the window’s `resize` event. The demo relies on d3.v5 and the `attr` and `style` methods to update coordinates and stroke properties.

AI-generated description