histogram的dataset 没有进行默认的Sturges 或者其他计算
arcsin1 opened this issue · comments
- I have searched the issues of this repository and believe that this is not a duplicate.
Steps to reproduce
- 在书写g2plot测试遇到dataset的 histogram方式没有默认去处理binwidth:
问题出处:源文件查看 - 业内一般处理会采用Sturges formula自动生成binWidth
Environment | Info |
---|---|
@antv/data-set | 0.11.4 |
System | mac |
Browser | 谷歌84 |
改进方式
Sturges formula:
export function sturges(values: Array<number>): number {
return Math.ceil(Math.log(values.length) / Math.LN2) + 1;
}
我觉得问题不大,可以直接 pr 上来。其实只是一个默认逻辑,也不会产生 break change。