Skip to main content
100%

Automatic Label Placement

✓ Published0🌍 Public
RRicCheng
Last edited Oct 4, 2016
Created on Oct 4, 2016

This example demonstrates automatic label placement on a choropleth map of the United Kingdom, building on Mike Bostock’s “Let’s Make a Map” tutorial. It shows how collision detection iteratively separates overlapping city name labels by adjusting their SVG transform translations until no overlaps remain. The map uses D3 v3 with `d3.geo.albers` projection, TopoJSON for geographic features, and SVG paths for subunit boundaries and place markers. Label positions are refined through a loop that compares `getBoundingClientRect` values and moves conflicting texts apart.

AI-generated description

Automatic Label Placement

This example is an extension of Mike Bostock’s tutorial Lets Make a Map that implements automatic label placement using collision detection. This is a proof of concept more than anything, not polished in any way.

References

forked from <a href='http://bl.ocks.org/larskotthoff/'>larskotthoff</a>'s block: <a href='http://bl.ocks.org/larskotthoff/11406992'></a>

mit Licensed

Similar vizzes