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

数值轴两端空白策略算法建议 #523

Closed
muzuiget opened this issue Aug 5, 2014 · 1 comment
Closed

数值轴两端空白策略算法建议 #523

muzuiget opened this issue Aug 5, 2014 · 1 comment

Comments

@muzuiget
Copy link
Contributor

muzuiget commented Aug 5, 2014

现在 boundaryGap 这个选项配合 scale: true 使用时,让我有些纠结(只对于Y轴)。

在原始数据的最值相差悬殊时,如果填小了,例如 [0.1, 0.1] 最大值的 0.1 差额依然会很大,最小值的 0.1 差额就很小。如果大部分数据都偏小的话,这样会让整条线偏低,几乎紧贴X轴了。当然,也可以把最小值的比率加高,但是实在太悬殊的话,就算是 0.9 也效果也不好。

所以我建议这个比率改乘以最值之差,(max - min) * boundaryGap[i] 而不是最值本身。这样比率一样的话,上下能留出相同高度的空白,保持线条居中。而且,如果原始数据最小值是不是负数,那么Y轴最小值也应该是0。

虽然我可以用 minmax 来自定义,但是发现切换到堆叠时状态时或拖曳重算时,Y轴没变动,会线条会超出格子背景。

或者 boundaryGap 能够接受一个函数,在Y轴需要变动时调用,参数是两个最值(原始/堆叠/拖曳后的数据),让用户自己来算合适的,接受返回的 [min, max]

@kener
Copy link
Contributor

kener commented Aug 11, 2014

这就是真实应用的思考反馈,很好的建议,下个版本升级。

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

2 participants