Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

changeData更新数据tooltip会消失 #5883

Closed
demolhy opened this issue Dec 5, 2023 · 1 comment
Closed

changeData更新数据tooltip会消失 #5883

demolhy opened this issue Dec 5, 2023 · 1 comment

Comments

@demolhy
Copy link

demolhy commented Dec 5, 2023

问题描述

需要重新移动鼠标才会显示,而且偶尔会跑到左下角去再回来

chart
.line()
.axis('x', {
  label: null,
  title: null,
  tickFilter: false,
  tick: false,
  line: false,
  grid: true,
  gridFilter: (_: any, index: number) => {
    return index % 10 === 0;
  },
})
.axis('y', {
  labelFormatter: (val: string) => {
    return `${val}%`;
  },
  line: true,
  lineExtension: [0, 0],
  lineStroke: '#EEEEEE',
})
.scale('y', { zero: true, type: 'linear', domain: [0, 100] })
.encode('x', 'time')
.encode('y', 'value')
.encode('shape', 'smooth')
.animate(false)
.encode('color', 'group')
.scale('color', {
  range: ['#00baa4', '#0090f8', '#f97316'],
  independent: true,
})
.interaction('tooltip', {
  render: (_: unknown, { title, items }: never) => tooltipRender(title, items),
})
.tooltip(
  (
    d, // 每一个数据项
  ) => {
    return {
      value: d.value + '%',
    };
  },
)
.style('strokeWidth', 1)

重现链接

No response

重现步骤

No response

预期行为

实时显示更新的tooltip数据,tooltip不消失

平台

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

屏幕截图或视频(可选)

bug.mp4

补充说明(可选)

No response

@pearmini
Copy link
Member

pearmini commented Dec 5, 2023

这是符合预期的,因为每次渲染都会销毁 tooltip。如果希望模拟不消失的效果,可以再每次调用 chart.changeData 之后,调用 chart.emit('tooltip', {}),具体参考文档

@antvis antvis locked and limited conversation to collaborators Dec 5, 2023
@pearmini pearmini converted this issue into discussion #5884 Dec 5, 2023

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants