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
Ggiulius540
Last edited Apr 30, 2021
Created on Apr 30, 2021

This example demonstrates how to create a D3.js visualization that responds to browser resizing. The code uses the `d3.select` API to append an SVG element to a fixed-position `#chart` div. On every resize event, the `redraw` function extracts the calculated `clientWidth` and `clientHeight` from the container, then adjusts the SVG's attributes and re-renders two intersecting lines into a green X mark. This approach uses CSS for layout sizing while relying on JavaScript event handling and the `merge` API for simple data updates.

AI-generated description

Comments

Sign in to join the discussion.

MIT Licensed