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

滚动条滚动之后tooltip等交互失效 #5650

Closed
KuduroJS opened this issue Oct 17, 2023 · 2 comments
Closed

滚动条滚动之后tooltip等交互失效 #5650

KuduroJS opened this issue Oct 17, 2023 · 2 comments

Comments

@KuduroJS
Copy link

/**
 * A recreation of this demo: https://observablehq.com/@d3/bar-chart
 */
import { Chart } from '@antv/g2';

const chart = new Chart({
  container: 'container',
  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%' })
  .scrollbar("x");

chart.render();

demo初始有tooltip交互,拖动滚动条后,tooltip失效。

@pearmini
Copy link
Member

pearmini commented Oct 17, 2023

这个问题已经修复了:#5632 ,可以试试 5.1.6-beta.0 这个版本。

@KuduroJS
Copy link
Author

KuduroJS commented Oct 17, 2023

@pearmini 更新到5.1.6-beta.0测试是可以的,感谢。但出现了另一个问题,当设置scale的时候会error,以及滚动失效。

demo如下:

/**
 * A recreation of this demo: https://vega.github.io/vega-lite/examples/bar_grouped_repeated.html
 */
import { Chart } from '@antv/g2';

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

chart.data({
  type: 'fetch',
  value: 'https://assets.antv.antgroup.com/g2/movies.json',
});

chart
  .interval()
  .transform({ type: 'groupX', y: 'sum' })
  .axis('y', { labelFormatter: '~s' })
  .axis('x', { labelTransform: 'rotate(90)' })
  .encode('x', 'Major Genre')
  .encode('y', 'Worldwide Gross')
  .encode('series', () => 'Worldwide Gross')
  .encode('color', () => 'Worldwide Gross')
  .tooltip({ channel: 'y', valueFormatter: '~s' })
  .scale('y', {
    key: "left", // 设置这里滚动会失效
    domainMin: 0,
    domainMax: 1,
    clamp: true
  })
  .scrollbar("x", {});

chart.render();

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

2 participants