use of com.eveningoutpost.dexdrip.Models.Prediction in project xDrip by NightscoutFoundation.
the class BgGraphBuilder method predictiveLines.
private List<Line> predictiveLines() {
final List<Line> lines = new LinkedList<>();
final boolean g_prediction = Pref.getBooleanDefaultFalse("show_g_prediction");
final boolean medtrum = Pref.getBooleanDefaultFalse("show_medtrum_secondary");
if (medtrum || g_prediction) {
final List<Prediction> plist = Prediction.latestForGraph(4000, loaded_start, loaded_end);
if (plist.size() > 0) {
final List<PointValue> gpoints = new ArrayList<>(plist.size());
final float yscale = !doMgdl ? (float) Constants.MGDL_TO_MMOLL : 1f;
for (Prediction p : plist) {
switch(p.source) {
case "EGlucoseRx":
final PointValue point = new PointValue(((float) (p.timestamp + (Constants.MINUTE_IN_MS * 10)) / FUZZER), (float) (p.glucose * yscale));
gpoints.add(point);
break;
case "Medtrum2nd":
final PointValue mpoint = new PointValue(((float) p.timestamp / FUZZER), (float) (p.glucose * yscale));
gpoints.add(mpoint);
break;
}
}
if (gpoints.size() > 0) {
lines.add(new Line(gpoints).setHasLabels(false).setHasPoints(true).setHasLines(false).setPointRadius(1).setColor(ChartUtils.darkenColor(ChartUtils.darkenColor(getCol(X.color_predictive)))));
}
}
}
return lines;
}
use of com.eveningoutpost.dexdrip.Models.Prediction in project xDrip-plus by jamorham.
the class BgGraphBuilder method predictiveLines.
private List<Line> predictiveLines() {
final List<Line> lines = new LinkedList<>();
final boolean g_prediction = Pref.getBooleanDefaultFalse("show_g_prediction");
final boolean medtrum = Pref.getBooleanDefaultFalse("show_medtrum_secondary");
if (medtrum || g_prediction) {
final List<Prediction> plist = Prediction.latestForGraph(4000, loaded_start, loaded_end);
if (plist.size() > 0) {
final List<PointValue> gpoints = new ArrayList<>(plist.size());
final float yscale = !doMgdl ? (float) Constants.MGDL_TO_MMOLL : 1f;
for (Prediction p : plist) {
switch(p.source) {
case "EGlucoseRx":
final PointValue point = new PointValue(((float) (p.timestamp + (Constants.MINUTE_IN_MS * 10)) / FUZZER), (float) (p.glucose * yscale));
gpoints.add(point);
break;
case "Medtrum2nd":
final PointValue mpoint = new PointValue(((float) p.timestamp / FUZZER), (float) (p.glucose * yscale));
gpoints.add(mpoint);
break;
}
}
if (gpoints.size() > 0) {
lines.add(new Line(gpoints).setHasLabels(false).setHasPoints(true).setHasLines(false).setPointRadius(1).setColor(ChartUtils.darkenColor(ChartUtils.darkenColor(getCol(X.color_predictive)))));
}
}
}
return lines;
}
Aggregations