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

存在多个 transform 的情况下,Tooltip 默认不会展示堆叠前的数据 #5952

Closed
YiSiWang opened this issue Dec 18, 2023 · 3 comments

Comments

@YiSiWang
Copy link
Contributor

问题描述

#4681 提到 Tooltip 默认展示堆叠前的数据,但是如果存在 .transform({ type: 'groupColor', y: 'count' }) ,会导致 Tooltip 展示堆叠后的数据:

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

const chart = new Chart({
  container: 'container',
  height: 640,
});

chart.coordinate({ type: 'theta', innerRadius: 0.6 });

chart
  .interval()
  .transform({ type: 'groupColor', y: 'count' })
  .transform({ type: 'stackY' })
  .data(
    [
      { name: 'A' },
      { name: 'A' },
      { name: 'A' },
      { name: 'B' },
      { name: 'C' },
    ]
  )
  .encode('color', 'name')
  .style('stroke', 'white')
  .style('inset', 1)
  .style('radius', 10)
  .scale('color', {
    palette: 'spectral',
    offset: (t) => t * 0.8 + 0.1,
  })
  .animate('enter', { type: 'waveIn' })
  .legend(false);

chart.render();
  1. 如何展示堆叠前的数据?
  2. 是否应该默认展示堆叠前?

重现链接

No response

重现步骤

No response

预期行为

No response

平台

  • 操作系统: [macOS, Windows, Linux, React Native ...]
  • 网页浏览器: [Google Chrome, Safari, Firefox]

屏幕截图或视频(可选)

No response

补充说明(可选)

No response

@pearmini
Copy link
Member

这例子中期望展现的堆叠前的数据是啥?

@YiSiWang
Copy link
Contributor Author

@pearmini 3,1,1 啊
不是三个A,1个B,1个C嘛

@pearmini
Copy link
Member

chart
  .interval()
  .interaction('tooltip', { shared: true }) // 这样?

@YiSiWang YiSiWang closed this as completed Jan 3, 2024
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