Skip to main content
100%

Overlapping labels - d3fc-label-layout

✓ Published0🌍 Public
PPatrick Wojda
Last edited Jun 10, 2019
Created on Jun 10, 2019

A scatterplot-style visualization places five Roman emperor labels inside a fixed rectangular bounds, using greedy layout from the d3fc-label-layout library to prevent overlapping labels. Each label measures its text bounding box via SVG `getBBox()` and positions points along a linear scale, with simulated annealing replaced by the greedy strategy for collision avoidance. The code renders SVG rectangles and text through d3 selections, combining d3.v4 scales with d3fc components such as `fc.layoutTextLabel`, `fc.layoutGreedy`, and `fc.layoutLabel` to arrange labels near their assigned y-values.

AI-generated description

Built with blockbuilder.org

mit Licensed

Similar vizzes