ecomfe / echarts-stat

Statistics tool for Apache ECharts
593 stars 309 forks source link

ecstat 处理分bin时报错 #26

Open feihongloveworld opened 4 years ago

feihongloveworld commented 4 years ago

在画直方图之前进行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 commented 3 years ago

upgrade v1.2.0