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
If there are a lot of matches in a sunburst, getComputedTextLength gets called a lot. Each call forces a re-layout. But this is not necessary because the pie pieces are too small to even see the name.
I have taken a look at the code and i do not immediately see how to fix this. The function is used to precompute all textlengths at first draw.
A heuristic might help (First printing all of [a-zA-Z0-9 -]) and computing only their lengths. To estimate the length of a new word we could just add the values form the map that correspond to the characters in the string.
I did only spot this issue now, but I have actually resolved this problem in version 2.0 of the sunburst. The available height of each piece of the chart is computed (as well as the height of the text that should fit into this piece) and the text is now only rendered if it fits into the piece of the chart.
I also noticed that the getComputedTextLength function is very slow in Chromium-based browsers. The measureText() function of OffscreenCanvas proves to be a lot faster, resolving this bottleneck :)
If there are a lot of matches in a sunburst,
getComputedTextLength
gets called a lot. Each call forces a re-layout. But this is not necessary because the pie pieces are too small to even see the name.I have taken a look at the code and i do not immediately see how to fix this. The function is used to precompute all textlengths at first draw.
A heuristic might help (First printing all of
[a-zA-Z0-9 -]
) and computing only their lengths. To estimate the length of a new word we could just add the values form the map that correspond to the characters in the string.Original issue by @beardhatcode on Wed Apr 11 2018 at 15:31.
The text was updated successfully, but these errors were encountered: