Fixed code so IA is also correctly displayed in ssecondary if it is the only selected option.
This commit is contained in:
parent
96d20d835f
commit
d528e800f6
|
@ -1560,7 +1560,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
||||||
graphData.formatAxis(fromTime, endTime);
|
graphData.formatAxis(fromTime, endTime);
|
||||||
|
|
||||||
if(SP.getBoolean("showactivityprimary", true)) {
|
if(SP.getBoolean("showactivityprimary", true)) {
|
||||||
graphData.addActivity(fromTime, endTime, 1d);
|
graphData.addActivity(fromTime, endTime, false,1d);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Treatments
|
// Treatments
|
||||||
|
@ -1588,6 +1588,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
||||||
boolean useDevForScale = false;
|
boolean useDevForScale = false;
|
||||||
boolean useRatioForScale = false;
|
boolean useRatioForScale = false;
|
||||||
boolean useDSForScale = false;
|
boolean useDSForScale = false;
|
||||||
|
boolean useIAForScale = false;
|
||||||
|
|
||||||
if (SP.getBoolean("showiob", true)) {
|
if (SP.getBoolean("showiob", true)) {
|
||||||
useIobForScale = true;
|
useIobForScale = true;
|
||||||
|
@ -1597,6 +1598,8 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
||||||
useDevForScale = true;
|
useDevForScale = true;
|
||||||
} else if (SP.getBoolean("showratios", false)) {
|
} else if (SP.getBoolean("showratios", false)) {
|
||||||
useRatioForScale = true;
|
useRatioForScale = true;
|
||||||
|
} else if (SP.getBoolean("showactivitysecondary", false)) {
|
||||||
|
useIAForScale = true;
|
||||||
} else if (SP.getBoolean("showdevslope", false)) {
|
} else if (SP.getBoolean("showdevslope", false)) {
|
||||||
useDSForScale = true;
|
useDSForScale = true;
|
||||||
}
|
}
|
||||||
|
@ -1610,7 +1613,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
||||||
if (SP.getBoolean("showratios", false))
|
if (SP.getBoolean("showratios", false))
|
||||||
secondGraphData.addRatio(fromTime, now, useRatioForScale, 1d);
|
secondGraphData.addRatio(fromTime, now, useRatioForScale, 1d);
|
||||||
if(SP.getBoolean("showactivitysecondary", true))
|
if(SP.getBoolean("showactivitysecondary", true))
|
||||||
secondGraphData.addActivity(fromTime, endTime, 1d);
|
secondGraphData.addActivity(fromTime, endTime, useIAForScale,1d);
|
||||||
if (SP.getBoolean("showdevslope", false) && MainApp.devBranch)
|
if (SP.getBoolean("showdevslope", false) && MainApp.devBranch)
|
||||||
secondGraphData.addDeviationSlope(fromTime, now, useDSForScale, 1d);
|
secondGraphData.addDeviationSlope(fromTime, now, useDSForScale, 1d);
|
||||||
|
|
||||||
|
@ -1627,6 +1630,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
||||||
|| SP.getBoolean("showcob", true)
|
|| SP.getBoolean("showcob", true)
|
||||||
|| SP.getBoolean("showdeviations", false)
|
|| SP.getBoolean("showdeviations", false)
|
||||||
|| SP.getBoolean("showratios", false)
|
|| SP.getBoolean("showratios", false)
|
||||||
|
|| SP.getBoolean("showactivitysecondary", false)
|
||||||
|| SP.getBoolean("showdevslope", false)) {
|
|| SP.getBoolean("showdevslope", false)) {
|
||||||
iobGraph.setVisibility(View.VISIBLE);
|
iobGraph.setVisibility(View.VISIBLE);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -346,7 +346,7 @@ public class GraphData {
|
||||||
? Profile.fromMgdlToUnits(bgReadingsArray.get(0).value, units) : Profile.fromMgdlToUnits(100, units);
|
? Profile.fromMgdlToUnits(bgReadingsArray.get(0).value, units) : Profile.fromMgdlToUnits(100, units);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addActivity(long fromTime, long toTime, double scale) {
|
public void addActivity(long fromTime, long toTime, boolean useForScale, double scale) {
|
||||||
FixedLineGraphSeries<ScaledDataPoint> actSeriesHist;
|
FixedLineGraphSeries<ScaledDataPoint> actSeriesHist;
|
||||||
List<ScaledDataPoint> actArrayHist = new ArrayList<>();
|
List<ScaledDataPoint> actArrayHist = new ArrayList<>();
|
||||||
FixedLineGraphSeries<ScaledDataPoint> actSeriesPred;
|
FixedLineGraphSeries<ScaledDataPoint> actSeriesPred;
|
||||||
|
@ -369,9 +369,6 @@ public class GraphData {
|
||||||
actArrayPred.add(new ScaledDataPoint(time, act, actScale));
|
actArrayPred.add(new ScaledDataPoint(time, act, actScale));
|
||||||
}
|
}
|
||||||
|
|
||||||
double maxIAValue = SP.getDouble(R.string.key_scale_insulin_activity, 0.05);
|
|
||||||
actScale.setMultiplier(maxY*scale / maxIAValue);
|
|
||||||
|
|
||||||
ScaledDataPoint[] actData = new ScaledDataPoint[actArrayHist.size()];
|
ScaledDataPoint[] actData = new ScaledDataPoint[actArrayHist.size()];
|
||||||
actData = actArrayHist.toArray(actData);
|
actData = actArrayHist.toArray(actData);
|
||||||
actSeriesHist = new FixedLineGraphSeries<>(actData);
|
actSeriesHist = new FixedLineGraphSeries<>(actData);
|
||||||
|
@ -392,6 +389,13 @@ public class GraphData {
|
||||||
paint.setColor(MainApp.gc(R.color.activity));
|
paint.setColor(MainApp.gc(R.color.activity));
|
||||||
actSeriesPred.setCustomPaint(paint);
|
actSeriesPred.setCustomPaint(paint);
|
||||||
|
|
||||||
|
double maxIAValue = SP.getDouble(R.string.key_scale_insulin_activity, 0.05);
|
||||||
|
if (useForScale) {
|
||||||
|
maxY = maxIAValue;
|
||||||
|
minY = -maxIAValue;
|
||||||
|
}
|
||||||
|
actScale.setMultiplier(maxY * scale / maxIAValue);
|
||||||
|
|
||||||
addSeries(actSeriesPred);
|
addSeries(actSeriesPred);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue