show boluses on bigchart
This commit is contained in:
parent
126322053e
commit
f6253284de
2 changed files with 31 additions and 5 deletions
|
@ -403,12 +403,12 @@ public class BIGChart extends WatchFace implements SharedPreferences.OnSharedPre
|
|||
ArrayList<DataMap> boluses = dataMap.getDataMapArrayList("boluses");
|
||||
if (boluses != null) {
|
||||
bolusWatchDataList = new ArrayList<>();
|
||||
for (DataMap basal : basals) {
|
||||
for (DataMap bolus : boluses) {
|
||||
BolusWatchData bwd = new BolusWatchData();
|
||||
bwd.date = basal.getLong("date");
|
||||
bwd.bolus = basal.getDouble("bolus");
|
||||
bwd.carbs = basal.getDouble("carbs");
|
||||
bwd.isSMB = basal.getBoolean("isSMB");
|
||||
bwd.date = bolus.getLong("date");
|
||||
bwd.bolus = bolus.getDouble("bolus");
|
||||
bwd.carbs = bolus.getDouble("carbs");
|
||||
bwd.isSMB = bolus.getBoolean("isSMB");
|
||||
bolusWatchDataList.add(bwd);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -158,6 +158,7 @@ public class BgGraphBuilder {
|
|||
}
|
||||
|
||||
lines.add(basalLine((float) minChart, factor, highlight));
|
||||
lines.add(bolusLine((float) minChart, factor));
|
||||
|
||||
return lines;
|
||||
}
|
||||
|
@ -184,6 +185,31 @@ public class BgGraphBuilder {
|
|||
|
||||
}
|
||||
|
||||
private Line bolusLine(float offset, double factor) {
|
||||
|
||||
List<PointValue> pointValues = new ArrayList<PointValue>();
|
||||
|
||||
for (BolusWatchData bwd: bolusWatchDataList) {
|
||||
if(bwd.date > start_time) {
|
||||
pointValues.add(new PointValue(fuzz(bwd.date), (float) offset+2));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Line line = new Line(pointValues);
|
||||
line.setColor(basalCenterColor);
|
||||
line.setHasLines(false);
|
||||
line.setPointRadius(pointSize);
|
||||
line.setHasPoints(true);
|
||||
|
||||
return line;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public Line highValuesLine() {
|
||||
Line highValuesLine = new Line(highValues);
|
||||
highValuesLine.setColor(highColor);
|
||||
|
|
Loading…
Reference in a new issue