antvis/G2

折线图单条数据不显示tooltip #5909

200-tonnage-boy posted onGitHub

问题描述

折线图在只有一条数据时不显示tooltip

重现链接

https://codesandbox.io/p/sandbox/beautiful-cartwright-9zm59s

重现步骤

No response

预期行为

No response

平台

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

屏幕截图或视频(可选)

<img width="787" alt="image" src="https://github.com/antvis/G2/assets/40828298/43e5d80d-646c-453f-90b8-77f09eb03fcd"> <img width="594" alt="image" src="https://github.com/antvis/G2/assets/40828298/563dd90d-3cfa-4a04-956c-b72c8c7e5529">

补充说明(可选)

No response


这种阶段情况应该需要处理一下

posted by pearmini over 1 year ago

定位到问题了,大概就是tooltip显示的有个前提是hover在整个“有渲染图表”内,而这个“有渲染图表”是根据最左侧和最右侧的x坐标来决定的,当只有一个点时,图表的minX和maxX是同一个值,就导致hover上去始终判定为在“有渲染图表”外,无法显示tooltip。 现在有个疑问时,如果只有折线图只有一个点的时候,预期是hover到点上会有tooltip显示还是说在一个范围内hover就会显示对应点的tooltip? src/interaction/tooltip.ts

posted by Runtus over 1 year ago

可以算一个:初级任务

posted by pearmini over 1 year ago

Fund this Issue

$0.00
Funded

Pull requests