Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Fork of Responding to Resize

Public visualization

Fork of Responding to Resize

0 stars0🌍 Public
CCristina Macaraig
Last edited Jul 17, 2021
Created on Jul 17, 2021

This example demonstrates a responsive SVG visualization that draws a green X spanning the full browser window. The chart container fills the page via CSS, and a `redraw()` function extracts the container’s `clientWidth` and `clientHeight` to set the SVG’s dimensions and position its two lines. Using D3 v5’s selection API (`d3.select`, `.append`, `.merge`), the code updates line coordinates and stroke properties on every window `resize` event, ensuring the graphic always matches the viewport.

AI-generated description

Comments

Sign in to join the discussion.

MIT Licensed