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
TTanjim702
Last edited Jan 3, 2021
Created on Jan 3, 2021

This example demonstrates a responsive SVG visualization that fills the browser window and redraws its content whenever the viewport size changes. It uses a CSS-positioned chart container to extract the computed client dimensions, then applies those values to set the SVG’s width and height attributes. The visualization draws two thick green diagonal lines forming an X, with the line coordinates recalculated on each resize event. The code leverages d3.js version 5 to select the container, append the SVG, and bind data to the line elements using the enter-merge pattern.

AI-generated description

Comments

Sign in to join the discussion.

MIT Licensed