Skip to content

Commit 9081c73

Browse files
committed
Fix - Internal lib - Fix issues with calcLinearProgression method
1 parent 19017e6 commit 9081c73

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/lib.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -847,7 +847,12 @@ export function calcLinearProgression(plots) {
847847
if (len < 2) return { x1: 0, y1: 0, x2: 0, y2: 0, slope: 0, trend: 0 };
848848

849849
let sx = 0, sy = 0, sxy = 0, sxx = 0;
850-
for (const { x, y } of plots) { sx += x; sy += y; sxy += x * y; sxx += x * x; }
850+
for (const { x, y } of plots) {
851+
sx += x;
852+
sy += y;
853+
sxy += x * y;
854+
sxx += x * x;
855+
}
851856
const denomPx = len * sxx - sx * sx || 1;
852857
const slopePx = (len * sxy - sx * sy) / denomPx;
853858
const interceptPx = (sy - slopePx * sx) / len;

0 commit comments

Comments
 (0)