draw basals only if pump is tempbasal capable
This commit is contained in:
parent
86f5aec0bb
commit
9edb5c9a66
|
@ -668,27 +668,29 @@ public class OverviewFragment extends Fragment {
|
|||
Double maxBasalValueFound = 0d;
|
||||
|
||||
long now = new Date().getTime();
|
||||
List<BarDataPoint> basalArray = new ArrayList<BarDataPoint>();
|
||||
for (long time = fromTime; time < now; time += 5 * 60 * 1000L) {
|
||||
TempBasal tb = MainApp.getConfigBuilder().getTempBasal(new Date(time));
|
||||
Double basal = 0d;
|
||||
if (tb != null)
|
||||
basalArray.add(new BarDataPoint(time, basal = tb.tempBasalConvertedToAbsolute(new Date(time)), true));
|
||||
else
|
||||
basalArray.add(new BarDataPoint(time, basal = profile.getBasal(NSProfile.secondsFromMidnight(new Date(time))), false));
|
||||
maxBasalValueFound = Math.max(maxBasalValueFound, basal);
|
||||
}
|
||||
BarDataPoint[] basal = new BarDataPoint[basalArray.size()];
|
||||
basal = basalArray.toArray(basal);
|
||||
bgGraph.addSeries(basalsSeries = new BarGraphSeries<DataPoint>(basal));
|
||||
basalsSeries.setValueDependentColor(new ValueDependentColor<DataPoint>() {
|
||||
@Override
|
||||
public int get(DataPoint data) {
|
||||
BarDataPoint point = (BarDataPoint) data;
|
||||
if (point.isTempBasal) return Color.BLUE;
|
||||
else return Color.CYAN;
|
||||
if (pump.getPumpDescription().isTempBasalCapable) {
|
||||
List<BarDataPoint> basalArray = new ArrayList<BarDataPoint>();
|
||||
for (long time = fromTime; time < now; time += 5 * 60 * 1000L) {
|
||||
TempBasal tb = MainApp.getConfigBuilder().getTempBasal(new Date(time));
|
||||
Double basal = 0d;
|
||||
if (tb != null)
|
||||
basalArray.add(new BarDataPoint(time, basal = tb.tempBasalConvertedToAbsolute(new Date(time)), true));
|
||||
else
|
||||
basalArray.add(new BarDataPoint(time, basal = profile.getBasal(NSProfile.secondsFromMidnight(new Date(time))), false));
|
||||
maxBasalValueFound = Math.max(maxBasalValueFound, basal);
|
||||
}
|
||||
});
|
||||
BarDataPoint[] basal = new BarDataPoint[basalArray.size()];
|
||||
basal = basalArray.toArray(basal);
|
||||
bgGraph.addSeries(basalsSeries = new BarGraphSeries<DataPoint>(basal));
|
||||
basalsSeries.setValueDependentColor(new ValueDependentColor<DataPoint>() {
|
||||
@Override
|
||||
public int get(DataPoint data) {
|
||||
BarDataPoint point = (BarDataPoint) data;
|
||||
if (point.isTempBasal) return Color.BLUE;
|
||||
else return Color.CYAN;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// set manual x bounds to have nice steps
|
||||
bgGraph.getViewport().setMaxX(toTime);
|
||||
|
@ -784,10 +786,12 @@ public class OverviewFragment extends Fragment {
|
|||
bgGraph.getGridLabelRenderer().setNumVerticalLabels(numOfHorizLines);
|
||||
|
||||
// set second scale
|
||||
bgGraph.getSecondScale().addSeries(basalsSeries);
|
||||
bgGraph.getSecondScale().setMinY(0);
|
||||
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
|
||||
if (pump.getPumpDescription().isTempBasalCapable) {
|
||||
bgGraph.getSecondScale().addSeries(basalsSeries);
|
||||
bgGraph.getSecondScale().setMinY(0);
|
||||
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
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue