draw basals only if pump is tempbasal capable

This commit is contained in:
Milos Kozak 2017-01-01 14:00:59 +01:00
parent 86f5aec0bb
commit 9edb5c9a66

View file

@ -668,6 +668,7 @@ public class OverviewFragment extends Fragment {
Double maxBasalValueFound = 0d; Double maxBasalValueFound = 0d;
long now = new Date().getTime(); long now = new Date().getTime();
if (pump.getPumpDescription().isTempBasalCapable) {
List<BarDataPoint> basalArray = new ArrayList<BarDataPoint>(); List<BarDataPoint> basalArray = new ArrayList<BarDataPoint>();
for (long time = fromTime; time < now; time += 5 * 60 * 1000L) { for (long time = fromTime; time < now; time += 5 * 60 * 1000L) {
TempBasal tb = MainApp.getConfigBuilder().getTempBasal(new Date(time)); TempBasal tb = MainApp.getConfigBuilder().getTempBasal(new Date(time));
@ -689,6 +690,7 @@ public class OverviewFragment extends Fragment {
else return Color.CYAN; else return Color.CYAN;
} }
}); });
}
// set manual x bounds to have nice steps // set manual x bounds to have nice steps
bgGraph.getViewport().setMaxX(toTime); bgGraph.getViewport().setMaxX(toTime);
@ -784,10 +786,12 @@ public class OverviewFragment extends Fragment {
bgGraph.getGridLabelRenderer().setNumVerticalLabels(numOfHorizLines); bgGraph.getGridLabelRenderer().setNumVerticalLabels(numOfHorizLines);
// set second scale // set second scale
if (pump.getPumpDescription().isTempBasalCapable) {
bgGraph.getSecondScale().addSeries(basalsSeries); bgGraph.getSecondScale().addSeries(basalsSeries);
bgGraph.getSecondScale().setMinY(0); bgGraph.getSecondScale().setMinY(0);
bgGraph.getSecondScale().setMaxY(maxBgValue / lowLine * maxBasalValueFound * 1.2d); bgGraph.getSecondScale().setMaxY(maxBgValue / lowLine * maxBasalValueFound * 1.2d);
bgGraph.getGridLabelRenderer().setVerticalLabelsSecondScaleColor(MainApp.instance().getResources().getColor(R.color.background_material_dark)); // same color as backround = hide bgGraph.getGridLabelRenderer().setVerticalLabelsSecondScaleColor(MainApp.instance().getResources().getColor(R.color.background_material_dark)); // same color as backround = hide
}
} }