Skip to main content
100%

Partition layout

✓ Published0🌍 Public
XXin Li
Last edited Apr 26, 2021
Created on Mar 25, 2021
Forked from Untitled

This example demonstrates a partition layout using D3.js, displaying hierarchical data as nested rectangles that encode data values through their areas. The visualization uses a static hierarchical dataset with named nodes (A1, B1, C1, etc.) and numeric sizes. The code creates the layout with `d3.partition()`, sizes it to 400×200 pixels, and applies hierarchy through `d3.hierarchy` with a `sum` accessor. Rectangles are rendered as SVG elements with opacity and white strokes, and their positions and dimensions are computed from the layout’s `x0`, `y0`, `x1`, and `y1` values.

AI-generated description

Simple example using d3 flame graph plugin: https://github.com/spiermar/d3-flame-graph

MIT Licensed

Similar vizzes