Search code examples
javascriptreactjshighchartsmouseeventpositioning

How to position tooltip regarding to mouse coordinates in Highcharts


I've got a map in Highcharts. When I point on any country I see tooltip bound to it. Sometimes tooltip appears under cursor and hide some information. Is there a way to position tooltip in positioner function regarding on mouse coordinates? Or maybe there is existing a more simple approach? I'm doing everything in react environment in options object.

Thanks!

Upd.

To clarify. I don't want to overlap mouse on tooltip. The difficulty is that the area of the country is different and tooltip is shown differently everywhere

enter image description here

enter image description here


Solution

  • I realized that my thought was wrong. If I calculate tooltip by mouse coordinates then we always need place it outside our area, otherwise we can overlap tooltip by cursor again. It's too complicated.

    I think the easiest way to do this - it's enable flag followPointer, which stick tooltip to your cursor.