ecomfe / echarts-stat

Statistics tool for Apache ECharts
595 stars 309 forks source link

precision -1 out of range #22

Closed shinnc closed 5 years ago

shinnc commented 5 years ago

I got the error from this line, may I know what's the reason there's a negative number for the precision?

// echarts-stat/dist/ecStat.js:1393
return + ((stop >= start ? step1 : -step1).toFixed(-precision));

These are the arguments in the function triggered the error: start=1199, stop=1953, count=9

This is how I initialize the graph:

data = [1701, 1585, 1669, 1953, 1429, 1593, 1641, 1638, 1768, 1524, 1608, 1679, 1731, 1254, 1232, 1238, 1661, 1199, 1921, 1731, 1570, 1548, 1521, 1548, 1620, 1811, 1696, 1527, 1771, 1477, 1775, 1672, 1330, 1400, 1780, 1716, 1811, 1626, 1519, 1395, 1677, 1295, 1317, 1411, 1524, 1291, 1570, 1540, 1690, 1616, 1707, 1748, 1631, 1569, 1557, 1602, 1530, 1811, 1606, 1480, 1528, 1277, 1638, 1579, 1580, 1493]
const bins = ecStat.histogram(data)

Edited: Just notice there's existing PR and issues https://github.com/ecomfe/echarts-stat/issues/16, https://github.com/ecomfe/echarts-stat/issues/21 addressing this, hence closing. Any maintainers care to merge the PR and release it?

limeng1900 commented 5 years ago

@deqingli 麻烦请问下大佬这个库是否还有后续的维护更新?直方图遇到同样的问题。

wmhh1129 commented 5 years ago

@shinnyx hey bro,can you get the solution?

shinnc commented 5 years ago

@wmhh1129 I fixed it by myself, realised that the PR https://github.com/ecomfe/echarts-stat/pull/18 wasn't really fixing the actual issue. https://github.com/urbanzoom/echarts-stat/commit/e389533ee4c750c5d62ebc9b7c94cfa8dd7e4a7b

wmhh1129 commented 5 years ago

@shinnyx sounds cool,i also realised that the PR seems useless,have you release your version in npm?

shinnc commented 5 years ago

@wmhh1129 Nope I didn't, I just explicitly specify in package.json to use the github version at the moment.

janhartmann commented 5 years ago

Is there anyone who can run a fork of this with these changes?