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

浏览器缩放、大小改变导致图表中绑定的click事件丢失 #5272

Closed
zhouhe-1476452306 opened this issue Jul 4, 2023 · 0 comments · Fixed by #5293
Closed

浏览器缩放、大小改变导致图表中绑定的click事件丢失 #5272

zhouhe-1476452306 opened this issue Jul 4, 2023 · 0 comments · Fixed by #5293
Assignees
Labels

Comments

@zhouhe-1476452306
Copy link

zhouhe-1476452306 commented Jul 4, 2023

当试图拖控制台时,发现给图表绑定的柱状图点击事件不进行再次触发。
主要排查情况是当图表进行chart.changeSize()或者chart.forceFit()事件绑定消失;
demo:

import { Chart } from '@antv/g2';

const chart = new Chart({
  container: 'container',
  theme: 'classic',
  autoFit: true,
});

chart
  .interval()
  .data({
    type: 'fetch',
    value:
      'https://gw.alipayobjects.com/os/bmw-prod/fb9db6b7-23a5-4c23-bbef-c54a55fee580.csv',
  })
  .encode('x', 'letter')
  .encode('y', 'frequency')
  .axis('y', { labelFormatter: '.0%' });

chart.render().then(e => {
  chart.on("interval:click",(e)=> {
    console.log(e.data);
  })
  chart.changeSize();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants