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

V4: Annotation 绘制 辅助线条 出现重叠现象 #5253

Closed
jzwyz opened this issue Jun 29, 2023 · 2 comments
Closed

V4: Annotation 绘制 辅助线条 出现重叠现象 #5253

jzwyz opened this issue Jun 29, 2023 · 2 comments

Comments

@jzwyz
Copy link

jzwyz commented Jun 29, 2023

  • G2 Version: v4.2.10
  • Platform: Macos Intel
  • Mini Showcase(like screenshots):
  • CodePen Link: CodePen Link

image
image

@jzwyz
Copy link
Author

jzwyz commented Jun 29, 2023

这是代码

.....

var annotations = [
  { start: ['1992', 'start'], end: ['1992', 'end'] },
  { start: ['1994', 'start'], end: ['1994', 'end'] },
  { start: ['1996', 'start'], end: ['1996', 'end'] },
  { start: ['1999', 'start'], end: ['1999', 'end'] }
]

......

annotations.forEach(f => {
  chart.annotation().line({
    ...f,
    style: { stroke: '#d9d9d9', lineWidth: 1, lineDash: [10, 10] } })
})

chart.render();

@jzwyz jzwyz closed this as completed Jun 30, 2023
@jzwyz jzwyz reopened this Jun 30, 2023
@hustcc
Copy link
Member

hustcc commented Aug 22, 2023

盲猜问题,每次重新 render 的时候,需要手动将 annotations clear 掉。

chart.getAnnotationController().clear();

@hustcc hustcc closed this as completed Aug 22, 2023
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

2 participants