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

Fix point tooltip shared #3511

Closed

Conversation

yp0413150120
Copy link

Checklist
  • npm test passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines
Description of change

修复散点图存在多个点在同一位置下,开启shared无反应

before after
修改前散点图shared 修改后散点图shared

@coveralls
Copy link

Pull Request Test Coverage Report for Build 1014675773

  • 24 of 29 (82.76%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.02%) to 93.373%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/util/tooltip.ts 4 6 66.67%
src/geometry/point.ts 20 23 86.96%
Totals Coverage Status
Change from base Build 1004967703: -0.02%
Covered Lines: 11108
Relevant Lines: 11534

💛 - Coveralls

shapes.push((child as IGroup).getShape(x, y, ev));
} else if ((child as IShape).isHit(x, y)) {
shapes.push(child);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

介绍下逻辑?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里直接参考了 g-basesrc/abstract/container.ts/getShape方法

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

之前是调用g-basegetShape方法,返回对应鼠标位置的shape(只返回单个),我就参照g-base,返回了对应鼠标位置的所有shapes,然后,因为返回的shape[]是个数组,就对g2/src/util/tooltip.ts稍微做了些改造,所有的改造基本都是基于老逻辑的

@visiky
Copy link
Member

visiky commented Jul 12, 2021

@hustcc tooltip 默认只展示捕获到的最近的数据点(一个),这里处理了之后,就是把所有命中 🎯 的点获取到

但我觉得 shared 的话,应该是从数据上有一个关联关系去获取到,而不是这里的获取所有 hit points,你有其它解法吗

@hustcc
Copy link
Member

hustcc commented Jul 12, 2021

没有太看懂逻辑,这个 pr 是修复哪一个 issue 的?

@visiky visiky linked an issue Jul 12, 2021 that may be closed by this pull request
2 tasks
@visiky
Copy link
Member

visiky commented Jul 12, 2021

没有太看懂逻辑,这个 pr 是修复哪一个 issue 的?

我也没看懂逻辑,你看下 issue

@visiky visiky closed this Jun 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tooltip 在分类字段为数值型字段时,显示不全
4 participants