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自定义name不符合预期 #6157

Open
kaokei opened this issue Apr 2, 2024 · 0 comments
Open

tooltip自定义name不符合预期 #6157

kaokei opened this issue Apr 2, 2024 · 0 comments

Comments

@kaokei
Copy link

kaokei commented Apr 2, 2024

问题描述

我希望可以自定义tooltip中的name字段。我在这里找到这样的代码

({
  tooltip: {
    items: [
      (d, index, data, column) => ({
        color: d.sold > 150 ? 'red' : 'blue', // 指定 item 的颜色
        name: index === 0 ? d.genre : `${d.genre} ${data[i].genre}`, // 指定 item 的名字
        value: column.y.value[i], // 使用 y 通道的值
      }),
    ],
  },
});

但实际上这里并不是直接自定义name属性,最终是把name属性当作字段值再次替换了一次,我期望的效果是直接使用我指定的name值。

可以直接在官网的demo中复现这个问题。https://g2.antv.antgroup.com/zh/examples/component/tooltip/#tooltip-series

重现链接

https://g2.antv.antgroup.com/zh/examples/component/tooltip/#tooltip-series

重现步骤

https://g2.antv.antgroup.com/zh/examples/component/tooltip/#tooltip-series
可以直接修改这里的name字段,会发现并不会生效。

预期行为

我不清楚目前的行为是否符合官方的预期,我的预期是直接使用我指定的name字符串。

平台

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

屏幕截图或视频(可选)

No response

补充说明(可选)

No response

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

1 participant