Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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!
On how to ask a technical question, if you really want an answer (courtesy of SQLBI)
User | Count |
---|---|
5 | |
5 | |
2 | |
2 | |
2 |
User | Count |
---|---|
10 | |
7 | |
4 | |
4 | |
4 |