Skip to main content
100%

Basic Circle Pack - Add or Remove Trees from the DOM

✓ Published0🌍 Public
BBrett Cunningham
Last edited Nov 20, 2019
Created on Nov 20, 2019
Forked from Basic Circle Pack

A circle-packing visualization displays a hierarchical dataset as nested circles, with buttons to add or remove data nodes from the DOM. Using D3 v5’s `d3.pack` layout and `d3.hierarchy`, the SVG renders each node’s size proportional to its value. Clicking a circle zooms via a tween that interpolates the view, while mouseover and mouseout events add or remove stroke outlines. The code uses D3 selections, transitions, and the `transition.tween` API for smooth animation.

AI-generated description

Demonstrates fundamental DOM manipulation using D3.js by making a smiley face whose eyebrows move.

MIT Licensed

Similar vizzes