Skip to main content
100%

Automatic Text Sizing

✓ Published0🌍 Public
663anp3ca
Last edited Sep 20, 2018
Created on Sep 20, 2018

A circle-packing visualization displays hierarchical data from a JSON file as nested circles, with each leaf node labeled by its name. The text size adjusts automatically to fit within each circle's diameter, using SVG text elements and a font-size calculation based on the circle's radius and the text's computed length. D3 v3's layout.pack positions the circles, while the code uses this.getComputedTextLength() to scale labels appropriately.

AI-generated description

forked from <a href='http://bl.ocks.org/mbostock/'>mbostock</a>'s block: <a href='http://bl.ocks.org/mbostock/1846692'>Automatic Text Sizing</a>

gpl-3.0 Licensed

Similar vizzes