Fix target line performance regression.
This commit is contained in:
parent
409acd0721
commit
9af0bc2976
1 changed files with 8 additions and 8 deletions
|
@ -243,7 +243,7 @@ public class GraphData {
|
||||||
targetsScale.setMultiplier(1);
|
targetsScale.setMultiplier(1);
|
||||||
|
|
||||||
List<DataPoint> targetsSeriesArray = new ArrayList<>();
|
List<DataPoint> targetsSeriesArray = new ArrayList<>();
|
||||||
double lastTarget = 0;
|
double lastTarget = -1;
|
||||||
|
|
||||||
if (LoopPlugin.lastRun != null && LoopPlugin.lastRun.constraintsProcessed != null) {
|
if (LoopPlugin.lastRun != null && LoopPlugin.lastRun.constraintsProcessed != null) {
|
||||||
APSResult apsResult = LoopPlugin.lastRun.constraintsProcessed;
|
APSResult apsResult = LoopPlugin.lastRun.constraintsProcessed;
|
||||||
|
@ -253,22 +253,22 @@ public class GraphData {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (long time = fromTime; time < toTime; time += 60 * 1000L) {
|
for (long time = fromTime; time < toTime; time += 5 * 60 * 1000L) {
|
||||||
TempTarget tt = TreatmentsPlugin.getPlugin().getTempTargetFromHistory(time);
|
TempTarget tt = TreatmentsPlugin.getPlugin().getTempTargetFromHistory(time);
|
||||||
double value;
|
double value;
|
||||||
if (tt == null) {
|
if (tt == null) {
|
||||||
value = (profile.getTargetLow(time) + profile.getTargetHigh(time)) / 2;
|
value = (profile.getTargetLow(time) + profile.getTargetHigh(time)) / 2;
|
||||||
} else {
|
} else {
|
||||||
value = tt.target();
|
value = Profile.fromMgdlToUnits(tt.target(), profile.getUnits());
|
||||||
value = Profile.fromMgdlToUnits(value, profile.getUnits());
|
|
||||||
}
|
}
|
||||||
if (lastTarget > 0 && lastTarget != value) {
|
if (lastTarget != value) {
|
||||||
targetsSeriesArray.add(new DataPoint(time, lastTarget));
|
if (lastTarget != -1)
|
||||||
|
targetsSeriesArray.add(new DataPoint(time, lastTarget));
|
||||||
|
targetsSeriesArray.add(new DataPoint(time, value));
|
||||||
}
|
}
|
||||||
lastTarget = value;
|
lastTarget = value;
|
||||||
|
|
||||||
targetsSeriesArray.add(new DataPoint(time, value));
|
|
||||||
}
|
}
|
||||||
|
targetsSeriesArray.add(new DataPoint(toTime, lastTarget));
|
||||||
|
|
||||||
DataPoint[] targets = new DataPoint[targetsSeriesArray.size()];
|
DataPoint[] targets = new DataPoint[targetsSeriesArray.size()];
|
||||||
targets = targetsSeriesArray.toArray(targets);
|
targets = targetsSeriesArray.toArray(targets);
|
||||||
|
|
Loading…
Reference in a new issue