Repository navigation
fix: spread crowded pie chart labels and fan out their leader lines - #2780
gadfly3173 wants to merge 1 commit into
Conversation
When many authors hold similar small percentages, their labels were anchored only a few pixels apart and every leader line shared a single vertical elbow, so names overlapped and lines became impossible to tell apart. Extract label drawing into DrawLabels, spread overlapping labels vertically via ArrangeLabels (shrinking the gap when a side runs out of room), and route each leader line straight from the arc edge to its own label anchor so the line-to-name mapping stays one-to-one readable. Also invalidate the visuals when SecondaryFontFamily changes.
|
I ran into the same issue and prototyped a fix in #2757 (comment) (screenshots there show the overlapping labels with small adjacent slices). My approach was similar in spirit:
That directly addresses the two concerns raised above: the drop step guarantees labels never exceed the available vertical space, and only labels that fit are drawn, so every visible leader line still points unambiguously at its slice. Happy to share the branch/commit if it's useful for comparison. |
|
@JC-Chung 我测试了你的相关提交,对于上面相同的情况(UnrealEngine仓库)
|
|
我已经交我本地的修改推送了 |
|
The last examples shows, that you need to rotate pie so that each side gets approximately equal count of sectors. Also, currently the inflection point of all leaders placed on the same circle, which produces bad results as in #2780 (comment). Need to decrease circle radius when label and inflection point have big difference on Y coordinate. |







When many authors hold similar small percentages, their labels were anchored only a few pixels apart and every leader line shared a single vertical elbow, so names overlapped and lines became impossible to tell apart.
Extract label drawing into DrawLabels, spread overlapping labels vertically via ArrangeLabels (shrinking the gap when a side runs out of room), and route each leader line straight from the arc edge to its own label anchor so the line-to-name mapping stays one-to-one readable. Also invalidate the visuals when SecondaryFontFamily changes.
Before:


After:


Increasing the single-author minimum threshold cannot completely solve this problem, for example, in this case: