Skip to main content
100%

Fork of Pack Layout

✓ Published0🌍 Public
DDing
Last edited Dec 31, 2022
Created on Dec 31, 2022
Forked from Pack Layout

This example visualizes a hierarchical dataset using D3’s pack layout, rendering circles for nodes and text labels for leaf values. The code builds a tree from an inline JavaScript object, sums leaf values with `root.sum()`, and applies a `d3.pack()` layout with a 300×300 size and 10-pixel padding. Each descendant is drawn as an `indianred` circle with white strokes and centered text, positioned via `transform` attributes. The SVG canvas is 960×500 units, and styling comes from an external CSS file.

AI-generated description

d3indepth.com/layouts/ Pack Layout

MIT Licensed

Similar vizzes