[chronojump] Fixed intersession, F,P / V profile with only 1 point
- From: Xavier Padullés <xpadulles src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] Fixed intersession, F,P / V profile with only 1 point
- Date: Tue, 13 Nov 2018 10:55:18 +0000 (UTC)
commit 10e90c7fd6f75ce42ef92fa82954def19d496a9d
Author: Xavier Padullés <x padulles gmail com>
Date: Tue Nov 13 11:53:51 2018 +0100
Fixed intersession, F,P / V profile with only 1 point
encoder/graph.R | 21 ++++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)
---
diff --git a/encoder/graph.R b/encoder/graph.R
index c7d0e84d..876b4a20 100644
--- a/encoder/graph.R
+++ b/encoder/graph.R
@@ -2123,15 +2123,18 @@ paintCrossVariables <- function (paf, varX, varY, option,
miny <- min(y1)
} else if(varX == "Speed" && varY == "Force") #is "Force,Power" but using Force to
have less problems
{
- fit = lm(y[thisSerie] ~ x[thisSerie])
- V0 = -coef(fit)[[1]] / coef(fit)[[2]]
- F0 = coef(fit)[[1]]
- if (F0 > maxy)
- maxy = F0
- if (V0 > maxx)
- maxx = V0
- miny = 0
- minx = 0
+ if(length(y[thisSerie]) > 1) #At least 2 points needed
+ {
+ fit = lm(y[thisSerie] ~ x[thisSerie])
+ V0 = -coef(fit)[[1]] / coef(fit)[[2]]
+ F0 = coef(fit)[[1]]
+ if (F0 > maxy)
+ maxy = F0
+ if (V0 > maxx)
+ maxx = V0
+ miny = 0
+ minx = 0
+ }
}
}
ylim <- c(miny, maxy)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]