Forum Discussion
Absolute position of tooltips
- 8 years ago
We would recommend to use the following code snippet:
// rootNode - root DOM element // e - is mouse event let rect = rootNode.getBoundingClientRect(); let coordinates = [e.clientX - rect.left - rootNode.clientLeft, e.clientY - rect.top - rootNode.clientTop];
Ignat Vilesov,
Software Engineer
Microsoft Power BI Custom Visuals
Do you use Tooltip API? If so, you need to get the absolute postion of the element without scrolling using JavaScript.
Ignat Vilesov,
Software Engineer
Microsoft Power BI Custom Visuals
I've tried using this:
var e = window.onmousemove;
var posX = e.clientX;
var posY = e.clientY;However, it doesn't work. How it can be done?
Regards,
Yerkhan
- v-viig8 years agoCommunity Champion
We would recommend to use the following code snippet:
// rootNode - root DOM element // e - is mouse event let rect = rootNode.getBoundingClientRect(); let coordinates = [e.clientX - rect.left - rootNode.clientLeft, e.clientY - rect.top - rootNode.clientTop];
Ignat Vilesov,
Software Engineer
Microsoft Power BI Custom Visuals
- Anonymous7 years agoNot applicable
I have a flow map visual in which tooltips are overflowing out of page.
let rect = rootNode.getBoundingClientRect();
let coordinates = [e.clientX - rect.left - rootNode.clientLeft, e.clientY - rect.top - rootNode.clientTop];Will the above code work and where should i exactly put this code to work ?
- v-viig7 years agoCommunity Champion
I think so. You should add this code to a function that generates coordinates for Tootip Service.
Ignat Vilesov,
Software Engineer
Microsoft Power BI Custom Visuals