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.
I have a Custom Visual that I want to display in a tooltip (Report Page Tooltip) but I need to know when the tooltip is shown (i.e. when the Custom Visual becomes visible). Is there any event I can listen to for this?
I have tried attaching a MutationObserver on the visua's element but this does not get fired.
Hi @gatapia,
Visuals are heavily sandboxed, so you're likely to only be able to do anything from inside.
When a tooltip is created, Power BI will initialise a visual, and at this point, your constructor method's code will execute. Note that this is exactly the same as if your visual is created on a page, or when a page containing your visual is navigated to.
The visual APIs do supply a CustomVisualHostEnv property via the IVisualHost (options.host in the constructor call, or options.host.hostEnv for the full property). However, there is no value for detecting whether the visual has been opened as a tooltip; I would expect that as report page tooltips are the same as report pages, Power BI will report its host environment as it normally would.
Another approach might be to inspect the hostCapabilities.allowInteractions object, which is typically set to false if the visual is displayed in a context that you should prohibit interactivit..., e.g. in a dashboard tile. I can't be 100% positive if this will be false if displayed in a tooltip, but it might give you what you want to achieve.
Failing that, you may need to raise an issue with the team to request an API that specifically gives you what you ...
Regards,
Daniel
Proud to be a Super User!
My course: Introduction to Developing Power BI Visuals
On how to ask a technical question, if you really want an answer (courtesy of SQLBI)
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 |
---|---|
22 | |
3 | |
2 | |
2 | |
2 |