From 987728d0259db1171d297719744fb0fedf7e7597 Mon Sep 17 00:00:00 2001 From: anhefti Date: Thu, 12 Sep 2019 19:31:54 +0200 Subject: [PATCH] fixed thresholds --- .../seb/sebserver/gui/service/session/IndicatorData.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/service/session/IndicatorData.java b/src/main/java/ch/ethz/seb/sebserver/gui/service/session/IndicatorData.java index e21f9b7a..e6a84b14 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/service/session/IndicatorData.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/service/session/IndicatorData.java @@ -51,13 +51,14 @@ final class IndicatorData { } static final int getColorIndex(final IndicatorData indicatorData, final double value) { - for (int j = 0; j < indicatorData.thresholdColor.length; j++) { - if (value > indicatorData.thresholdColor[j].value && value < indicatorData.thresholdColor[j].value) { + final int top = indicatorData.thresholdColor.length - 1; + for (int j = 0; j < top; j++) { + if (value > indicatorData.thresholdColor[j].value && value < indicatorData.thresholdColor[j + 1].value) { return j; } } - return -1; + return top; } static final class ThresholdColor {