Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feat]: 实现类似于4.0的getTooltipItems方法 #6623

Open
interstellarmt opened this issue Mar 3, 2025 · 6 comments
Open

[Feat]: 实现类似于4.0的getTooltipItems方法 #6623

interstellarmt opened this issue Mar 3, 2025 · 6 comments
Labels
feature 💡 A new feature request or an enhancement proposal

Comments

@interstellarmt
Copy link
Contributor

interstellarmt commented Mar 3, 2025

Describe the feature / 功能描述

传入point[x,y],返回对应的tooltipItems
使用场景:通过"plot:click"点击返回坐标,调用chart.getTooltipItems()获得数据,完成后续业务逻辑。

Are you willing to contribute? / 是否愿意参与贡献?

Please select / 请选择

@interstellarmt interstellarmt added waiting for maintainer Triage or intervention needed from a maintainer feature 💡 A new feature request or an enhancement proposal and removed waiting for maintainer Triage or intervention needed from a maintainer labels Mar 3, 2025
@antvis antvis deleted a comment from petercat-assistant bot Mar 3, 2025
@interstellarmt
Copy link
Contributor Author

Image

Image

@interstellarmt
Copy link
Contributor Author

interstellarmt commented Mar 3, 2025

4.0 的"tooltip:change" 事件也可以实现类似效果,考虑先实现其中一种

@BQXBQX
Copy link
Contributor

BQXBQX commented Mar 3, 2025

我想尝试一下,有 v4 的效果展示样例吗?我参照一下,实现后放到 v5 官网上。

@interstellarmt
Copy link
Contributor Author

我写个demo,写好了贴在这里~

@BQXBQX
Copy link
Contributor

BQXBQX commented Mar 4, 2025

4.0 的"tooltip:change" 事件也可以实现类似效果,考虑先实现其中一种

貌似 tooltip:change 位置变化的回调函数可以通过监听 tooltip:show 等价实现。

现在更需要的是一个 tooltip 渲染数据(内部渲染内容)发生变化的监听,还是 tooltip 位置发生变化的监听呢?

@interstellarmt
Copy link
Contributor Author

getTooltipItems其实就是返回Point(x,y)距离最近的元素的tooltipItems。
依赖的业务场景:点击图上任何位置,获取最近的元素的信息,做相应的展示更新。
现在看来tooltip:show可以等价实现,那感觉getTooltipItems的优先级没有那么高了,看下有没有更依赖这个api的场景吧

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature 💡 A new feature request or an enhancement proposal
Projects
None yet
Development

No branches or pull requests

2 participants