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

ecstat 处理分bin时报错 #26

Open
feihongloveworld opened this issue Dec 17, 2019 · 1 comment
Open

ecstat 处理分bin时报错 #26

feihongloveworld opened this issue Dec 17, 2019 · 1 comment

Comments

@feihongloveworld
Copy link

在画直方图之前进行ecStat.histogram(height,'scott')数据分箱。但是报错
数据如下:
var height = [200,70, 65, 63, 72, 81, 83, 66, 75, 80, 75, 79, 76, 76, 69, 75, 74, 85, 86, 71, 64, 78, 80, 74, 72, 77, 81, 82, 80, 80, 80, 87];
var bins = ecStat.histogram(height,'scott');
报错函数:
return function (start, stop, count) {
var step0 = Math.abs(stop - start) / count;
var precision = Math.floor(Math.log(step0) / Math.LN10);
var step1 = Math.pow(10, precision);
var error = step0 / step1;
if (error >= Math.sqrt(50)) {
step1 *= 10;
}
else if (error >= Math.sqrt(10)) {
step1 *= 5;
}
else if(error >= Math.sqrt(2)) {
step1 *= 2;
}
return +((stop >= start ? step1 : -step1).toFixed(-precision));

报错提示: toFix 函数输入值在0-1之间,而-precision为-1

@littleee
Copy link

upgrade v1.2.0

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

2 participants