antvis/G2

双y轴的刻度线怎么设置对齐 #3459

bancangyanyu posted onGitHub

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

What problem does this feature solve?

双y轴的刻度线对齐

What does the proposed API look like?

双y轴的刻度线对齐

<!-- generated by antv-issue-helper. DO NOT REMOVE -->


目前暂时无法做到,这个算法比较复杂。当前解法暂时为以下 3 种:

  1. 同步 双轴的 max min 范围,这样自然是对其的
  2. 关闭其中一层,防止 grid 线条会很混乱
  3. 两个 scale 自定义 tick,保持比例一致
posted by hustcc almost 4 years ago

@pearmini 可以考虑下两个 scale 同步 ticks 的算法~

posted by hustcc almost 4 years ago

好的,我去了解一下

posted by pearmini almost 4 years ago

@bancangyanyu 要是你的对应Y轴上的 scale 中的 tickCount 的数量是自定义设置的话,那么双 Y轴上的 tickCount可以设置相同,可以解决不对齐的问题。

posted by BraveHead almost 4 years ago

image

posted by yehoan almost 3 years ago

不知道为什么会这样...

posted by yehoan almost 3 years ago

我看示例的 不是这样的啊 至少刻度线是统一的才对啊

posted by yehoan almost 3 years ago

可以参考我的做法 meta: { tt: { alias: '在租天数', sync: true, min: 0, max: max1, tickInterval: getNumber(max1) / 5, tickCount: 5, }, amount: { alias: '新增订单金额', sync: true, min: 0, max: max2, tickInterval: getNumber(max2) / 5, tickCount: 5, }, }

posted by cdx111 over 1 year ago

可以参考我的做法 meta: { tt: { alias: '在租天数', sync: true, min: 0, max: max1, tickInterval: getNumber(max1) / 5, tickCount: 5, }, amount: { alias: '新增订单金额', sync: true, min: 0, max: max2, tickInterval: getNumber(max2) / 5, tickCount: 5, }, }

getNumber是什么方法

posted by Calmio-Y 9 months ago

getNumber

一个普通字符串转number的方法

posted by cdx111 9 months ago

可以参考一下这个 PR https://github.com/antvis/G2/pull/6380

posted by pearmini 8 months ago

Fund this Issue

$0.00
Funded

Pull requests