vasturiano / sunburst-chart

A sunburst interactive chart web component for visualizing hierarchical data
https://vasturiano.github.io/sunburst-chart/example/flare/
MIT License
292 stars 89 forks source link

Is there an ability to make tooltip static and doesn't follow cursor? #76

Open Karpengold opened 2 years ago

Karpengold commented 2 years ago

I would like to add some actionable items inside tooltip, but I can't interact with them cause tooltip follows cursor.

Is there ability to make tooltip static?

vasturiano commented 2 years ago

@Karpengold thanks for reaching out.

That's not supported by the module per se, but you can always create your own system of tooltips externally, using the onHover or onClick event handlers.

Karpengold commented 2 years ago

@vasturiano Thank you for the answer. Maybe there is a chance that you have some kind of example of custom tooltip? I'm not sure that I understand how I can turn off default tooltip functionality and provide my own

vasturiano commented 2 years ago

@Karpengold I don't have an example of what you're looking for exactly, but you can basically disable the current default tooltip with .showTooltip(false), and then use onHover to code your own logic/placement for a tooltip element you control. The onHover method receives as argument the node object that's being currently hovered, or null if it's an hover out event.

Karpengold commented 2 years ago

@vasturiano Thank you very much, I did it and it works well. Only one little thing that I found: if the mouse is moving really fast onHover effect is not triggered with null prop

Karpengold commented 2 years ago

Also it would be nice to have Event object in onHover function :)