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)

74d80dc2cfed4611aebc2e3f8c6bf3b3

Fork of Responding to Resize

0 stars0🌍 Public
AAbdulazizfh
Last edited Jan 27, 2021
Created on Jan 27, 2021

This example demonstrates a full-page SVG that dynamically resizes to match its container. It uses D3 v5 to select the chart div and append an SVG element, then defines a redraw function which extracts the container’s CSS-computed `clientWidth` and `clientHeight` to set the SVG’s attributes. A green diagonal cross is drawn with `selectAll` and data-bound `line` elements, merging enter and update selections. The function runs initially and listens for the browser `window` `resize` event, redrawing the graphic to fill the viewport.

AI-generated description