Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi everyone,
I have custom visual with vertical scroll bar. And tooltips are positioned by coordinates of elements, therefore some tooltips are at the bottom of the screen or lower How tooltips can be positioned by absolute coordinates?
Regards,
Yerkhan
Solved! Go to Solution.
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
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
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 ?
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
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
13 | |
2 | |
1 | |
1 | |
1 |
User | Count |
---|---|
25 | |
3 | |
2 | |
2 | |
2 |