ecomfe / echarts-stat

Statistics tool for Apache ECharts
595 stars 309 forks source link

所有数据都为0的时候报错 #12

Open fancyer opened 6 years ago

fancyer commented 6 years ago
const data = [0, 0, 0, ..., 0]
ecStat.histogram(data)

类似这样所有数据都相等的情况,就会报错: RangeError: toFixed() digits argument must be between 0 and 100

是不是应该特殊处理一下这种情况?

ToughRover commented 6 years ago

我遇到同样的问题,不是所有数据为零的情况,在一些普通数据的情况下也报同样的错误, 在Chrome环境出问题. const data = [57000, 40200, 21450, 21900, 45000]; ecStat.histogram(data, 'squareRoot');

linsamasama commented 4 years ago

遇到相同问题,怎么破? [ { time: "2020-05-28", value: 4.749111135818938e-128 }, { time: "2020-05-29", value: 1.9445002621807343e-135 }, { time: "2020-05-30", value: 4.8240249731249535e-141 }, { time: "2020-05-31", value: 2.0295387975990008e-140 }, { time: "2020-06-01", value: 1.7432224154496785e-143 }, { time: "2020-06-02", value: 3.7666884255905245e-145 }, { time: "2020-06-03", value: 1.438483051784299e-147 } ]

linsamasama commented 4 years ago

遇到相同问题,怎么破? [ { time: "2020-05-28", value: 4.749111135818938e-128 }, { time: "2020-05-29", value: 1.9445002621807343e-135 }, { time: "2020-05-30", value: 4.8240249731249535e-141 }, { time: "2020-05-31", value: 2.0295387975990008e-140 }, { time: "2020-06-01", value: 1.7432224154496785e-143 }, { time: "2020-06-02", value: 3.7666884255905245e-145 }, { time: "2020-06-03", value: 1.438483051784299e-147 } ]

自己解决了