antvis/G2

使用 lineY 绘制辅助线设置 arrow 时, 对 lineY进行更新, arrow 会重复进行绘制 #6396

mosaice posted onGitHub

问题描述

参考 官网中的例子 如果后续对 lineY 数据进行更新,会出现绘制错误

image

重现链接

https://codesandbox.io/s/lucid-colden-mkycwc?file=/index.ts

重现步骤

  1. 设置 lineY 并设置 style('arrow', true)
  2. chart.render() , 渲染完成后更新lineY 数据并再次 render

预期行为

预期: 箭头应该会随 lineY 变化, 实际: 除了箭头会绘制在对应的新值位置上, 会有多余的箭头出现在错误位置

平台

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

屏幕截图或视频(可选)

image

补充说明(可选)

#4845 No response


这个场景中还发现了另外一个问题,当chart 设置autoFit: true 时,每次重新绘制 lineY 都会导致 canvas 高度增加,复现的方式,我已经更新

https://codesandbox.io/s/lucid-colden-mkycwc?file=/index.ts

不知道有什么方式可以避免这种计算错误问题

posted by mosaice 8 months ago

这个场景中还发现了另外一个问题,当chart 设置autoFit: true 时,每次重新绘制 lineY 都会导致 canvas 高度增加,复现的方式,我已经更新

https://codesandbox.io/s/lucid-colden-mkycwc?file=/index.ts

不知道有什么方式可以避免这种计算错误问题

通过强制设置父容器的高度可以避免这个自动增高的问题,但是我觉得这个现象还是有问题的

posted by mosaice 8 months ago

解决这个最好的做法是在 G 中去处理 Path shape,在他销毁的时候,也需要把对应的 marker 销毁。

image

posted by hustcc 8 months ago

Fund this Issue

$0.00
Funded

Pull requests