Skip to main content
100%

Circle Packing

✓ Published0🌍 Public
GGerHobbelt
Last edited Sep 11, 2012
Created on Sep 11, 2012

A circle packing visualization displays a hierarchy of data points as nested circles, using the D3 `d3.layout.pack` layout. The code masks a background image with the circular layout, while leaf nodes are rendered as circular-clipped silhouette images using SVG `clipPath` and `mask` elements. The visualization uses D3 v2 and reads hierarchical JSON data from a `flare.json` file. It renders as SVG, with circles styled by depth and each leaf node containing an image clipped to its circular boundary.

AI-generated description

Experiment …… <a href="http://bl.ocks.org/3696645" title="view this gist via bl.ocks.org">∆</a> <a href="http://bl.ocks.org/GerHobbelt" title="view a list of all my gists at bl.ocks.org">∞</a>

==========================================================================

A little alternative way to use the SVG <image> object and D3:

D3 code creates a layout-based mask, where each node is a circle + circle-clipped 'silhouette' image, which is, of course, included in the generated mask.

WARNING: clip-mask applied to elements inside a SVG mask don't work in Safari/Win; Chrome works okay, so this result is best viewed in bleeding edge Chrome.

Similar vizzes