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
Aavgoust
Last edited May 16, 2022
Created on May 16, 2022

This example demonstrates a responsive D3.js visualization that automatically redraws an SVG cross to match the browser window’s dimensions. It uses CSS to stretch a container div to fill the page, then reads the container’s `clientWidth` and `clientHeight` inside a `redraw` function. The code binds data to `line` elements, entering new lines and merging updates, while a `window` resize event listener triggers redraws. The visualization relies on D3 v5 and SVG rendering, showing how to handle dynamic viewport sizes in data-driven graphics.

AI-generated description

Comments

Sign in to join the discussion.

MIT Licensed