Skip to main content
100%

Fork of Responding to Resize

✓ Published0🌍 Public
Hhamza.miftah@gmail.com
Last edited Jul 10, 2022
Created on Jul 10, 2022

This example demonstrates a responsive SVG visualization that fills the entire browser window and redraws its content whenever the viewport size changes. It shows two thick, semi-transparent green lines forming an X across the full width and height of the chart container. The code uses D3 v5 to select the `#chart` div, append an SVG element, and bind line data to render the X. A `redraw` function reads the container’s `clientWidth` and `clientHeight` to update the SVG’s dimensions, then repositions the lines via the `merge` pattern. The `window.addEventListener("resize", redraw)` triggers this responsive behavior.

AI-generated description
MIT Licensed

Similar vizzes