Skip to main content
100%

Fork of Responding to Resize

✓ Published0🌍 Public
Ppangaotata
Last edited Mar 23, 2021
Created on Mar 23, 2021

This example demonstrates a responsive D3.js visualization that draws a simple teal X across an SVG canvas. The chart container fills the entire browser window using CSS positioning, and the `redraw()` function dynamically extracts the container’s client width and height on every resize event. The code then sets the SVG’s dimensions accordingly and uses D3’s data join to update two line elements, ensuring the X always stretches corner-to-corner. The visualization relies on `d3.select`, `attr`, and the window’s `resize` listener, with all rendering performed via SVG line elements.

AI-generated description
MIT Licensed

Similar vizzes