antvis/G2

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

interstellarmt posted onGitHub

Describe the feature / 功能描述

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

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

Please select / 请选择


Image

Image

posted by interstellarmt about 2 months ago

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

posted by interstellarmt about 2 months ago

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

posted by BQXBQX about 2 months ago

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

posted by interstellarmt about 2 months ago

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

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

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

posted by BQXBQX about 2 months ago

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

posted by interstellarmt about 2 months ago

Fund this Issue

$0.00
Funded

Pull requests