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

Brush: 如何在框选之后获得框选的数据? #3827

Closed
imyuxh opened this issue Mar 14, 2022 · 2 comments
Closed

Brush: 如何在框选之后获得框选的数据? #3827

imyuxh opened this issue Mar 14, 2022 · 2 comments

Comments

@imyuxh
Copy link

imyuxh commented Mar 14, 2022

  • G2 Version:
  • Platform:
  • Mini Showcase(like screenshots):
  • CodePen Link:

您好 请教个问题:
想做一个框选的效果, 但是不是用g2自带的filter 而是想要拿到框选后的数据(准确说是x轴的时间),然后重新取发请求。目前通过回调函数能拿到context,以及通过context获得x,y坐标。请问我可以直接拿到框选后的数据吗?如果是要通过坐标自己计算的话,要如何计算呢?
谢谢

@visiky visiky changed the title 如何在框选之后获得框选的数据? Brush: 如何在框选之后获得框选的数据? Apr 26, 2022
@visiky
Copy link
Member

visiky commented Jun 14, 2022

duplicate with: #3755

@hustcc
Copy link
Member

hustcc commented Aug 22, 2023

Sorry, due to problems in the program's architecture design, we are unable to effectively fix the issues. But it fixed in G2 5.0, you can have a try.

chart.on('brush:filter', (event) => {
  const { selection } = event.data;
  const [domainX, domainY] = selection;
  const [minX, maxX] = domainX;
  const [minY, maxY] = domainY;
  console.log(minX, maxX, minY, maxY);
});

@hustcc hustcc closed this as completed Aug 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants