cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
satishr Member
Member

Custom visual tool-tips for line chart

I'm creating a custom visual which has a line chart with multiple lines. How to create the tool-tip similar to power bi native line chart? I have created simple tool-tips for bar charts but couldn't create one for a line chart. Also, the tool-tips doesn't seem to work if the bars in the bar chart is overlapping (bar-in-bar chart). I can share my code if required.

1 ACCEPTED SOLUTION

Accepted Solutions
Moderator v-viig
Moderator

Re: Custom visual tool-tips for line chart

If you need to show a tooltip for dots you should render the dots first.

Please used d3.data method to bind data to each dot. Each data point must contain tooltip data that you want to show.

After that you need call addTooltip as you do in the code but the first argument must represent d3.selection for dots.

 

Ignat Vilesov,

Software Engineer

 

Microsoft Power BI Custom Visuals

pbicvsupport@microsoft.com

View solution in original post

3 REPLIES 3
Moderator v-viig
Moderator

Re: Custom visual tool-tips for line chart

We don't have any sample custom visual that implements tooltip for line chart.

It seams you should detect cursor position and get data that is related to mouse position. After that, you should send data to Tooltip API.

 

Ignat Vilesov,

Software Engineer

 

Microsoft Power BI Custom Visuals

pbicvsupport@microsoft.com

satishr Member
Member

Re: Custom visual tool-tips for line chart

Thanks for your reply @v-viig. I understand that the tool-tips in the native line chart are quite advanced. I will be happy with simple tool-tips which shows on hovering the dots which connects the lines in the line chart. Can you help me with that? I have shared my code with you

Moderator v-viig
Moderator

Re: Custom visual tool-tips for line chart

If you need to show a tooltip for dots you should render the dots first.

Please used d3.data method to bind data to each dot. Each data point must contain tooltip data that you want to show.

After that you need call addTooltip as you do in the code but the first argument must represent d3.selection for dots.

 

Ignat Vilesov,

Software Engineer

 

Microsoft Power BI Custom Visuals

pbicvsupport@microsoft.com

View solution in original post

Helpful resources

Announcements
Ask Amir Anything

Exclusive LIVE Community Event No. 2 – Ask Amir Anything

Next in our Triple A series: Ask Amir Netz questions about the latest updates, features and future.

Ask Amanda Anything Q&A

Ask Amanda Anything Q&A

Learn the answers to some of the questions asked during the Amanda Triple A event.

October 2019 Community Highlights

October 2019 Community Highlights

October was a busy month in the community. Read the recap article to learn about some of the events and content.

New Solution Badges

New Solution Badges

Two waves of brand new solution badges are coming! Read the article for more information on our new community badges.

Users Online
Currently online: 6 members 3,350 guests
Please welcome our newest community members: