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

scale 中的 nice:true 对于坐标轴的 tick 计算感觉效果没有 3.0 的时候好 #3260

Closed
1 task
SunGuoQiang123 opened this issue Feb 2, 2021 · 4 comments

Comments

@SunGuoQiang123
Copy link

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

Reproduction link

https://g2.antv.vision/en/examples/line/basic#base

Steps to reproduce

将 chart.scale 方法中 value 字段的配置项中 去掉 min:0 的配置,只保留 nice:true 效果和不设置 nice:true 是一样的
nice 设为 true 后,并没有起到 3.0 中 对 max 和 min 的调整效果
查看文档后 设置 tickMethod: 'r-pretty' 后 效果和 3.0 是一致的
文档说 r-pretty tickCount 精度太差 具体是什么问题 有什么样的影响呢 3.0 是使用的 r-pretty ?

Environment Info
g2 4.1.9
System mac 10.15.7
Browser 88.0.4324.96
@hustcc
Copy link
Member

hustcc commented Feb 3, 2021

4.0 重构之后,选择了新的算法,这个你如果觉得 r-pretty 更优,可以直接选择这个。算法本身没有优劣,只有一方面好一方面坏。

@visiky
Copy link
Member

visiky commented Feb 3, 2021

支持自己选择 tick-method,官网搜文档

@mimof9
Copy link

mimof9 commented Feb 3, 2021

tickCount精度太差是指,如果用r-pretty算法,计算出来的ticks和指定的tickCount可能差距很大吧?

@pearmini
Copy link
Member

tickCount精度太差是指,如果用r-pretty算法,计算出来的ticks和指定的tickCount可能差距很大吧?

是的,几种 tickMethod 的差异可以看这里:https://github.com/antvis/scale/blob/master/docs/api/tick-methods.md,这里的 d3Ticks 就是现在的 d3Linear

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

5 participants