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

[Bug]: 自定义 shape 时,进行 legend 筛选后,autofit 位置错误 #6606

Open
2 of 10 tasks
BQXBQX opened this issue Feb 14, 2025 · 2 comments
Open
2 of 10 tasks
Labels
waiting for maintainer Triage or intervention needed from a maintainer

Comments

@BQXBQX
Copy link
Contributor

BQXBQX commented Feb 14, 2025

Describe the bug / 问题描述

当使用自定义 shape 时,进行 legend 筛选后,进行 autofit 后 ,element 位置会发生错误(element 的位置被固定在初始位置了)

Reproduction link / 复现链接

No response

Steps to Reproduce the Bug or Issue / 重现步骤

20250214103403_rec_.mp4

Version / 版本

Please select / 请选择

OS / 操作系统

  • macOS
  • Windows
  • Linux
  • Others / 其他

Browser / 浏览器

  • Chrome
  • Edge
  • Firefox
  • Safari (Limited support / 有限支持)
  • IE (Nonsupport / 不支持)
  • Others / 其他
@BQXBQX BQXBQX added the waiting for maintainer Triage or intervention needed from a maintainer label Feb 14, 2025
Copy link

在使用 antvis/G2 时,自定义形状(Shape)可能会导致在进行 legend 筛选和 autofit 操作后,元素位置出现错误。这通常是因为自定义形状在图例筛选后没有正确更新其位置。

解决方案建议

  1. 确保正确注册和使用自定义形状

    • 自定义形状需要通过 G2.register('shape.${mark}.${shape}', Shape) 进行注册。
    • 使用时可以通过 mark.encodemark.style 指定形状。
  2. 检查自定义形状的渲染函数

    • 确保自定义形状的渲染函数正确处理了图形的控制点和映射值。
    • 在自定义形状中,使用 document.createElement 创建图形元素时,确保所有位置和样式属性都正确设置。
  3. 更新图表布局

    • 在 legend 筛选后,调用 chart.render() 以确保图表重新渲染并更新布局。
  4. 调试自定义形状逻辑

    • 检查自定义形状的逻辑,确保在 legend 筛选后,形状的位置和大小能够正确响应数据变化。

如果这些建议没有解决问题,可能需要进一步检查自定义形状的实现细节,或者提供一个最小可复现的代码示例以便更具体地帮助解决问题。

🪧 Tips For further assistance, please describe your question in the comments and @petercat-assistant to start a conversation with me.

@BQXBQX
Copy link
Contributor Author

BQXBQX commented Feb 14, 2025

Image 问题在这里,当动画结束后,style.d 又进行了重置,这里是有什么额外的设计用途吗?🤔

@BQXBQX BQXBQX changed the title [Bug]: 自定义 shape 时,进行 legend 筛选后,autofit 是 element 位置错误 [Bug]: 自定义 shape 时,进行 legend 筛选后,autofit 位置错误 Feb 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting for maintainer Triage or intervention needed from a maintainer
Projects
None yet
Development

No branches or pull requests

1 participant