You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
display: "auto" only hides overlapping labels based on the relative index; I instead need to hide, if 2 or more labels overlap, the label that has the smallest value. I got this far, and it partially works, but only if I manually hover the mouse pointer over each slice of the doughnut in turn:
I think the problem is that datalabels only computes the layout of the labels if the label is visible, but I need the layout of the label to decide whether it should be visible. Also my code above feels a bit gross as it's reaching into undocumented data structures of datalabels, and also it's technically O(n^2) - although n tends to be small.
Does anyone have any suggestion about how to ask datalabel to reliably give me the layout of the label even if it has not been computed yet?
In case it helps, the chart in question is a doughnut chart with a single dataset and datalabels config anchor: "end", align: "end"
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
display: "auto"
only hides overlapping labels based on the relative index; I instead need to hide, if 2 or more labels overlap, the label that has the smallest value. I got this far, and it partially works, but only if I manually hover the mouse pointer over each slice of the doughnut in turn:I think the problem is that datalabels only computes the layout of the labels if the label is visible, but I need the layout of the label to decide whether it should be visible. Also my code above feels a bit gross as it's reaching into undocumented data structures of datalabels, and also it's technically
O(n^2)
- althoughn
tends to be small.Does anyone have any suggestion about how to ask datalabel to reliably give me the layout of the label even if it has not been computed yet?
In case it helps, the chart in question is a doughnut chart with a single dataset and datalabels config
anchor: "end", align: "end"
Beta Was this translation helpful? Give feedback.
All reactions