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
satishr
Helper III
Helper III

Custom visual tooltip service not working

I'm writing a custom visual with some KPIs and a bar chart. I have created the bar chart by following the below article.
https://tsmatz.wordpress.com/2016/09/27/power-bi-custom-visuals-programming/

The visual is working fine. Now I want a display a tooltip when mouse hovered on the bar chart. I followed the below documentation (couldn't understand most of it) and implemented the same.
https://github.com/Microsoft/PowerBI-visuals/blob/master/Visual/Tooltips.md

 

My visual doesn't show anything. When I cross-checked the culprit was this line in the constructor.

this.tooltipServiceWrapper = createTooltipServiceWrapper(this.host.tooltipService, options.element);

When I commented this line, my visual works fine. What I'm I doing wrong? How to get the tooltips working?
Please help asap!
2 ACCEPTED SOLUTIONS
v-viig
Community Champion
Community Champion

Thank you for sharing. We're going to look into the issue. 

 

Ignat Vilesov,

Software Engineer

 

Microsoft Power BI Custom Visuals

pbicvsupport@microsoft.com

View solution in original post

@v-viig Thanks for sharing the solution. Below were the changes done in my code.

this.tooltipServiceWrapper.addTooltip(this.svg.selectAll('.bar'),
(tooltipEvent: TooltipEventArgs<BarData>) => Visual.getTooltipData(tooltipEvent.data),
(tooltipEvent: TooltipEventArgs<BarData>) => null);

private static getTooltipData(data: BarData): VisualTooltipDataItem[] {
return [{
displayName: data.Date,
value: `${data.Indicator}`,
}];
}

View solution in original post

11 REPLIES 11

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.