Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Vertical Label Placement (iamkate.com)
3 points by todsacerdoti on Aug 6, 2024 | hide | past | favorite | 1 comment


It's a little hard to understand what the post is talking about until you play with the demo, which I recommend doing. As the items are dragged and near other labels, slow down to see the other labels displace. You can start stacking labels on top of each other to see how it handles displacing more than one label.

The idea is that text needs to be placed next to an item its describing but might overlap with other text labels. If you're allowed to move the other text labels up and down a bit, what algorithm should you use to "optimally" place the text as much in line with the labels they're sitting next to but not overlapping with other text labels? This post looks to define a cost function and provide a linear time algorithm to minimize it optimally.

Source is available and CC0 [0].

[0] https://github.com/KateMorley/vertical_label_placement




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: