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

fix(label): random hide label when set overflowHide #6210

Closed
wants to merge 2 commits into from

Conversation

Runtus
Copy link
Contributor

@Runtus Runtus commented Apr 27, 2024

Checklist
  • npm test passes
  • benchmarks are included
  • commit message follows commit guidelines
  • documents are updated
Description of change
  • 修复标签在图形上放置不下的时候,随机隐藏标签的问题。
image

fix: #6199

@coveralls
Copy link

coveralls commented Apr 27, 2024

Pull Request Test Coverage Report for Build 8856672178

Details

  • 3 of 3 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.003%) to 86.378%

Totals Coverage Status
Change from base Build 8796197038: 0.003%
Covered Lines: 10298
Relevant Lines: 11549

💛 - Coveralls

@Runtus Runtus changed the title fix(label): random hidde label when set overflowHide fix(label): random hide label when set overflowHide Apr 27, 2024
@hustcc
Copy link
Member

hustcc commented Apr 27, 2024

这个 bug 原因是啥?

@Runtus
Copy link
Contributor Author

Runtus commented Apr 27, 2024

这个 bug 原因是啥?

我是直接从上层来改的这个bug,即通过忽略坐标小数点之后的大小来判断是否溢出。
源码是直接把label的边界坐标和label所属于的柱形(拿这张图来说)的边界直接做坐标的比较。但是有个问题是,给的坐标值很精细,有些label的边界坐标和柱形坐标的在小数点两位甚至一位之前都是相同的。例如一个是123.114514 另一个是 123.11513,这已经是肉眼不可见的像素级别了,所以我就对坐标直接做保留一位小数,然后再做比较。
至于为什么给的坐标为什么那么精细以及有的label坐标溢出,有的没有溢出,我就没有深究了。

@hustcc
Copy link
Member

hustcc commented Apr 27, 2024

如果实际的两个区域大小是对的,计算逻辑也没问题,那其实不用特别处理,相当于 issue 中反馈的情况是符合预期的。

@Runtus
Copy link
Contributor Author

Runtus commented Apr 27, 2024

如果实际的两个区域大小是对的,计算逻辑也没问题,那其实不用特别处理,相当于 issue 中反馈的情况是符合预期的。

明白了,我拿测量工具看了的,计算得到的坐标位置都没问题,就是精度问题导致有些label的判断是超出,而有些是没有的。
那符合预期的话,这个pr就不用管了?

@hustcc
Copy link
Member

hustcc commented Apr 27, 2024

明白了,我拿测量工具看了的,计算得到的坐标位置都没问题,就是精度问题导致有些label的判断是超出,而有些是没有的。

那符合预期的话,这个pr就不用管了?

是的,只要没有计算逻辑问题,那就是符合预期的,即使改精度解决了这个 case,用户在柱子宽度变化的时候还是会遇到类似的困惑。

@Runtus Runtus closed this Apr 27, 2024
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

Successfully merging this pull request may close these issues.

overflowHide 对于标签在图形上放置不下的时候,随机隐藏标签。
3 participants