最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Am chart v4 Tooltip issue - Stack Overflow

programmeradmin2浏览0评论

I am using XY chart for line chart in amchart v4 , I am phasing issue in tooltip, I have customize tooltip text as html , but when mouse hover one line show all line tooltip, I want only selected line tooltip not for all lines, please help

Following image describes the issue that I'm facing:

I am using XY chart for line chart in amchart v4 , I am phasing issue in tooltip, I have customize tooltip text as html , but when mouse hover one line show all line tooltip, I want only selected line tooltip not for all lines, please help

Following image describes the issue that I'm facing:

Share Improve this question edited Dec 3, 2019 at 4:42 Hardik Modha 12.7k3 gold badges38 silver badges42 bronze badges asked Nov 21, 2018 at 12:21 Rahul.kmarRahul.kmar 893 silver badges8 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 5

I'm afraid that while the Chart Cursor (XYCursor) is enabled, there's no way to lock down onto only one series' tooltip while multiple series' tooltips are defined. Even if you define a tooltip on their bullets and give the bullets a new tooltip object (because by default they use their series' tooltip), Chart Cursor will still trigger the bullets' tooltips. I'll see if there is a way to opt-in/out of the force hover behavior of Chart Cursor, but at the moment it seems that is not the case.

If you need the Chart Cursor, what you can do is only assign tooltipHTML to just one series. Especially since it seems all of your tooltips are showing the exact same data.

It seems like you're aware of the following already but I'll mention these just in case. You can find an example of single series tooltip in our guide on HTML content for tooltips, "Adding interactive elements". And here's the CodePen demo it shows:

https://codepen.io/team/amcharts/pen/Wgmzga

If you can go without Chart Cursor, that opens up the doors for tooltips appearing based on the series you hover over.

Here's an example that starts with Chart Cursor and just a tooltip on one series, then if you click the button on the top right and wait a second, it'll kill the Chart Cursor, enable bullets with tooltipHTML set on them instead:

https://codepen.io/team/amcharts/pen/371ab4d22e7a9c7dffeca36a3c54fe6a

This should make one tooltip to rule them all:

https://www.amcharts./docs/v4/reference/xycursor/#maxTooltipDistance_property

chart.cursor = new am4charts.XYCursor() chart.cursor.maxTooltipDistance = -1

发布评论

评论列表(0)

  1. 暂无评论