-
I've created a zoomable Sunburst visualization in React Typescript that's functionally working well. However, when I attempt to rotate the text, using a function I've used in the past with D3, the rotation is off. The function is:
The other problem I'm having is that while zoom events hide unselected parts of the node tree (the UPDATE: I got the text to rotate properly on first render with:
and I got the text to hide on zoom by checking for an existing parent path before rendering:
I still don't get why my |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
The
|
Beta Was this translation helpful? Give feedback.
The
x0
,x1
,y0
,y1
variables don't update on zoom, so myrotateText()
function wasn't updating after zooming. Instead, I moved rotation into state, and then inside auseLayoutEffect()
hook, found radians toarc.centroid
and assigned the rotation: