Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
gatapia
Frequent Visitor

Custom Visual Displayed inside a Tooltip - Listen to Visibility Change

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. 

 

1 REPLY 1
dm-p
Super User
Super User

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





Did I answer your question? Mark my post as a solution!

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)




Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.