optimize overview graph drawing
This commit is contained in:
parent
a39f61284a
commit
74268675af
2 changed files with 19 additions and 6 deletions
|
@ -12,7 +12,7 @@ public class AutosensData {
|
||||||
public double deviation = 0d;
|
public double deviation = 0d;
|
||||||
boolean calculateWithDeviation = false;
|
boolean calculateWithDeviation = false;
|
||||||
double absorbed = 0d;
|
double absorbed = 0d;
|
||||||
double carbsFromBolus = 0d;
|
public double carbsFromBolus = 0d;
|
||||||
public double cob = 0;
|
public double cob = 0;
|
||||||
public double bgi = 0d;
|
public double bgi = 0d;
|
||||||
public double delta = 0d;
|
public double delta = 0d;
|
||||||
|
|
|
@ -1296,17 +1296,30 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
||||||
List<DataPoint> iobArray = new ArrayList<>();
|
List<DataPoint> iobArray = new ArrayList<>();
|
||||||
List<DataPoint> cobArray = new ArrayList<>();
|
List<DataPoint> cobArray = new ArrayList<>();
|
||||||
List<DeviationDataPoint> devArray = new ArrayList<>();
|
List<DeviationDataPoint> devArray = new ArrayList<>();
|
||||||
|
double lastIob = -1000;
|
||||||
|
int lastCob = 0;
|
||||||
for (long time = fromTime; time <= now; time += 5 * 60 * 1000L) {
|
for (long time = fromTime; time <= now; time += 5 * 60 * 1000L) {
|
||||||
if (showIobView.isChecked()) {
|
if (showIobView.isChecked()) {
|
||||||
IobTotal iob = IobCobCalculatorPlugin.calulateFromTreatmentsAndTemps(time);
|
double iob = IobCobCalculatorPlugin.calulateFromTreatmentsAndTemps(time).iob;
|
||||||
iobArray.add(new DataPoint(time, iob.iob));
|
if (Math.abs(lastIob - iob) > 0.02) {
|
||||||
maxIobValueFound = Math.max(maxIobValueFound, Math.abs(iob.iob));
|
if (Math.abs(lastIob - iob) > 0.2)
|
||||||
|
iobArray.add(new DataPoint(time, lastIob));
|
||||||
|
iobArray.add(new DataPoint(time, iob));
|
||||||
|
maxIobValueFound = Math.max(maxIobValueFound, Math.abs(iob));
|
||||||
|
lastIob = iob;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (showCobView.isChecked() || showDeviationsView.isChecked()) {
|
if (showCobView.isChecked() || showDeviationsView.isChecked()) {
|
||||||
AutosensData autosensData = IobCobCalculatorPlugin.getAutosensData(time);
|
AutosensData autosensData = IobCobCalculatorPlugin.getAutosensData(time);
|
||||||
if (autosensData != null && showCobView.isChecked()) {
|
if (autosensData != null && showCobView.isChecked()) {
|
||||||
cobArray.add(new DataPoint(time, autosensData.cob));
|
int cob = (int) autosensData.cob;
|
||||||
maxCobValueFound = Math.max(maxCobValueFound, autosensData.cob);
|
if (cob != lastCob) {
|
||||||
|
if (autosensData.carbsFromBolus > 0)
|
||||||
|
cobArray.add(new DataPoint(time, lastCob));
|
||||||
|
cobArray.add(new DataPoint(time, cob));
|
||||||
|
maxCobValueFound = Math.max(maxCobValueFound, cob);
|
||||||
|
lastCob = cob;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (autosensData != null && showDeviationsView.isChecked()) {
|
if (autosensData != null && showDeviationsView.isChecked()) {
|
||||||
int color = Color.BLACK; // "="
|
int color = Color.BLACK; // "="
|
||||||
|
|
Loading…
Reference in a new issue