ecomfe / echarts-stat

Statistics tool for Apache ECharts
595 stars 309 forks source link

polynomial expression precision #40

Open feidudu1 opened 3 years ago

feidudu1 commented 3 years ago

echarts-stat/src/regression.js

if (i > 1) {
    string += Math.round(coeArray[i] * Math.pow(10, i + 1)) / Math.pow(10, i + 1) + 'x^' + i + ' + ';
}

this result in dispaly as 0x^2 + -0.01x + 36.58, the expected expression is -0.0005x^2 + -0.01x + 36.58 graph used echarts-stat image graph used excel image