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

wip: 修复镜像极坐标下的部分问题 #3087

Closed
wants to merge 4 commits into from

Conversation

SentretC
Copy link
Contributor

@SentretC SentretC commented Dec 6, 2020

WIP: 测试暂缺

Checklist
  • npm test passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines
Description of change

对极坐标系施加 reflect('x')scale(-1, 1)scale(1, -1) 变换都可以将其由顺时针改为逆时针
但在当前版本中都存在一些问题 (Issue #3051)
其中 reflect('x') 似乎更为合适也更容易修复
因此本 PR 专注于解决与极坐标系镜像有关的问题

例1:玉珏图

镜像 修改前 修改后
X
Y

已解决:reflect('x') 时的弧线方向、line axis 的文字位置
未解决:label 不显示(与镜像无关)

例2:极坐标系下的分组柱状图

镜像 修改前 修改后
X
Y

已解决:reflect('x') 时柱顶弧线方向、circle axis 的方向、reflect('y') 时图形不显示
未解决:shared tooltip 拾取错误(根源在@antv/coord)、active-region 显示位置错误

例3:玫瑰图-限定角度范围

(注释掉verticalFactor: 1

镜像 修改前 修改后
X
Y

已解决:需要手动指定 verticalFactorreflect('x') 时柱顶弧线方向、circle axis 的方向、reflect('y') 时 circle axis 的 label 不显示
未解决:line axis 的 label 与图例重叠、一条位置错误的 line grid(与镜像无关)、reflect('x') 时 circle grid 弧线方向(需决定修改@antv/component还是g2)

Correct directions of arcs converted from lines when the coordinate is reflected in the x dimension.
This allows users to make polar charts counter-clockwise by adding `.reflect('x')`
@coveralls
Copy link

Pull Request Test Coverage Report for Build 404222489

  • 2 of 3 (66.67%) changed or added relevant lines in 3 files are covered.
  • 4 unchanged lines in 1 file lost coverage.
  • Overall coverage increased (+0.05%) to 93.42%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/util/axis.ts 0 1 0.0%
Files with Coverage Reduction New Missed Lines %
src/chart/controller/axis.ts 4 95.53%
Totals Coverage Status
Change from base Build 399768748: 0.05%
Covered Lines: 10677
Relevant Lines: 11085

💛 - Coveralls

@hustcc
Copy link
Member

hustcc commented Mar 10, 2021

@SentretC coordinate 的分支合并之后,这里是否可以关闭了?

@Break-2020
Copy link

@SentretC coordinate 的分支合并之后,这里是否可以关闭了?

你好,我想问一下坐标系逆时针设置的这个修复现在有beta版本可以用吗

@SentretC
Copy link
Contributor Author

@SentretC coordinate 的分支合并之后,这里是否可以关闭了?

抱歉这段时间有些自顾不暇,coord 那个 PR 是对这个的补充而非替代
由于这边比 coord 复杂,在测试用例编写方面我不太有把握(差的主要就是测试了),主要是应该从哪些层面和角度进行测试,针对修改的函数本身以及实际柱状图的包围框这两方面可以吗,后者应该算 bug 测试、柱状图的单元测试还是其他?
另外之前尝试模仿现有用例编写的时候遇到了舍入误差问题,并且由于是出现在路径数组中不能直接使用 toBeCloseTo,有什么递归判断的方法,还是说应该找一组不产生舍入误差的数字或怎样?
希望能有人在这些方面给我一些指导,谢谢

@SentretC
Copy link
Contributor Author

在 pre-commit 过程中遇到了与我改动无关的错误,比如文档中代码过长、text-spec.ts 测试不通过(第 10 行)等
后者可能是环境问题,我用的是 Windows 系统
可以用 --no-verify 跳过检查吗?

@SentretC
Copy link
Contributor Author

@hustcc 可以麻烦解答一下上面关于是否可以用 --no-verify 跳过 pre-commit test 的问题吗?

@hustcc hustcc closed this May 31, 2021
@zhaochu0821
Copy link

我按照你修改的方式修改文件,为什么reflect('x')还是无效啊
image
image

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.

None yet

5 participants