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

尖底漏斗图, 最后一个label位置计算错误 #1847

Closed
1 task
fingerpan opened this issue Dec 24, 2019 · 1 comment · Fixed by #2143 or #2211
Closed
1 task

尖底漏斗图, 最后一个label位置计算错误 #1847

fingerpan opened this issue Dec 24, 2019 · 1 comment · Fixed by #2143 or #2211
Assignees
Milestone

Comments

@fingerpan
Copy link

  • I have searched the issues of this repository and believe that this is not a duplicate.

Reproduction link

Edit on CodeSandbox

Steps to reproduce

  1. 设置shape("pyramid")
  2. 显示label

What is expected?

最后一个,也就是三角尖图形的label位置计算错误,有细微偏移

What is actually happening?

正常显示最后一个label

Environment Info
g2 3.5.11
System 所有
Browser 所有
@fingerpan
Copy link
Author

src/geom/label/geom-label.js (328行)

  if (point.shape === 'pyramid' && !point.nextPoints && point.points) {
     point.points.forEach(function (p) {
        p = coord.convert(p);

        if ((Util.isArray(p.x) && !point.x.includes(p.x)) || (Util.isNumber(p.x) && point.x !== p.x)) {
          label.x = (label.x + p.x) / 2;
        }
      });
    }

这段代码计算错误, 三个点(三角形),累计计算会出现错误。

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 a pull request may close this issue.

2 participants