diff --git a/pom.xml b/pom.xml
index c9b7ed8c..0c9cbd8c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -63,19 +63,11 @@
ca.umontreal.iro.simul
ssj
3.3.2
+
- com.google.code.gson
- gson
-
-
-
- org.jfree
- jcommon
-
-
- org.jfree
- jfreechart
+ *
+ *
@@ -104,6 +96,11 @@
io.jenkins.plugins
plugin-util-api
+
+ org.apache.commons
+ commons-math3
+ 3.6.1
+
org.jenkins-ci.plugins
display-url-api
diff --git a/src/main/java/hudson/tasks/junit/History.java b/src/main/java/hudson/tasks/junit/History.java
index 21a8517b..2f8d4a78 100644
--- a/src/main/java/hudson/tasks/junit/History.java
+++ b/src/main/java/hudson/tasks/junit/History.java
@@ -46,10 +46,10 @@
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
import jenkins.util.SystemProperties;
+import org.apache.commons.math3.stat.regression.SimpleRegression;
import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.NoExternalUse;
import org.kohsuke.stapler.bind.JavaScriptMethod;
-import umontreal.ssj.functionfit.LeastSquares;
import umontreal.ssj.functionfit.SmoothingCubicSpline;
/**
@@ -248,7 +248,13 @@ private void createLinearTrend(
if (history.size() < 3) {
return;
}
- double[] cs = LeastSquares.calcCoefficients(lrX, lrY);
+
+ SimpleRegression sr = new SimpleRegression(true);
+ for (int i = 0; i < lrX.length; i++) {
+ sr.addData(lrX[i], lrY[i]);
+ }
+ double intercept = sr.getIntercept();
+ double slope = sr.getSlope();
ObjectNode lrSeries = MAPPER.createObjectNode();
series.add(lrSeries);
@@ -273,7 +279,7 @@ private void createLinearTrend(
}
for (int index = 0; index < history.size(); ++index) {
// Use float to reduce JSON size.
- lrData.add((float) (Math.round((cs[0] + index * cs[1]) * roundMul) / roundMul));
+ lrData.add((float) (Math.round((intercept + index * slope) * roundMul) / roundMul));
}
}