Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Fork of Fork of Responding to Resize

Public visualization

Fork of Fork of Responding to Resize

0 stars0🌍 Public
Ccharliemok
Last edited Feb 1, 2021
Created on Feb 1, 2021
Forked from Untitled

This example demonstrates a simple responsive chart that dynamically adjusts an SVG to fill the browser viewport. It first extracts the client width and height from its container, then sets the SVG’s `width` and `height` attributes accordingly, and redraws two green diagonal lines to verify the resizing behavior. The visualization uses D3.js v5 to create and update the SVG elements, leveraging a listener for the window’s `resize` event to trigger the redraw. The code relies on the `d3.select` API to bind the chart container and `attr` to update the SVG dimensions.

AI-generated description

Comments

Sign in to join the discussion.

MIT Licensed