Skip to main content
Public

Share visualization

Loading preview…

Fork of Responding to Resize

vizhub.com

Shared links may look like this on X, LinkedIn, Slack, and Discord.

Before sharing, review the publishing checklist.

Choose how to deliver this visualization

LinkedIn caption

LinkedIn may not keep text supplied by the share sheet. Copy the caption and paste it into the post if needed. You can tag the VizHub company page when posting.

More options

Embed on a websiteCopy iframe embed code
Download & exportPNG, HTML, source ZIP

Fork of Responding to Resize

0
AAmandineM97
Last edited Apr 13, 2022
Created on Apr 13, 2022

A full-window SVG responds to browser resizing by redrawing an X-shape through two crossing lines. The `#chart` container uses fixed CSS positioning to fill the viewport, and a `resize` event listener calls a `redraw()` function that reads `clientWidth` and `clientHeight` to update the SVG dimensions. D3 v5 binds the line data to the selection, merging enter and update nodes to adjust coordinates, stroke-width, opacity, and green color. The example demonstrates a simple pattern for size-aware, responsive visualization.

AI-generated description

Comments

Sign in to join the discussion.

MIT Licensed