Skip to main content
100%

Fork of Responding to Resize

✓ Published0🌍 Public
NNYCUBK201
Last edited Sep 18, 2023
Created on Sep 18, 2023

This example demonstrates how an SVG visualization can automatically resize to fill its container. It renders two green, semi-transparent lines forming an X that spans the full width and height of the available space. The code uses d3.v5 to select the chart div and append an SVG element, then a `redraw()` function extracts `clientWidth` and `clientHeight` from the container to update the SVG’s dimensions and line coordinates. A window `resize` event listener triggers this function, ensuring the visualization always matches the browser’s viewport size.

AI-generated description
MIT Licensed

Similar vizzes