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

[Feature missing] 在4.0版本中,scale-linear的minTickInterval属性缺失 #2107

Closed
JamesChenX opened this issue Mar 1, 2020 · 2 comments

Comments

@JamesChenX
Copy link

  • G2 Version: 4.0
  • Platform: Chrome v80.0.3987.116
  • Mini Showcase(like screenshots):
    image
  • CodePen Link: No

在3.X版本中,scale的linear类型具有minTickInterval属性,可以用来设置tick的最小间距。但在4.0中,此属性无法生效,并且在下述文档中也并没有提及替代其实现的方法。

https://g2.antv.vision/zh/docs/manual/concepts/data-and-scales/#%E6%95%B0%E6%8D%AE%E7%B1%BB%E5%9E%8B%E4%B8%8E%E5%BA%A6%E9%87%8F-scale

@dxq613
Copy link
Member

dxq613 commented Mar 3, 2020

4.0 中 Scale 计算 ticks 的方案发生了变化,默认内置的几个 tickMethod 目前仅有时间的支持 minTickInterval,其他的没有默认实现。
这次把 tickMethod 开放出来的目的就是为了定制,而现在的两种默认的方案都是用的学术上现有的算法,没有考考 minTickInterval,甚至 tickInterval 都没有考虑,添加 minTickInterval 会导致这两种算失效。
现在有两种选择,一种是把原先 3.x 的 scale 计算方案也迁移进来,另一种是你可以自己写个支持 minTickInterval 的算法,在scale 定义的时候设置

chart.scale('xxx', {
  tickMethod: (scale) {
    return  ticks;
 }
});

@Dante-dan
Copy link

请在文档中注明。谢谢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants