Fix Scale
This commit is contained in:
parent
015ec3a937
commit
f08eefbf9c
|
@ -915,7 +915,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
|
|||
if (menuChartSettings[g + 1][OverviewMenus.CharType.COB.ordinal]) secondGraphData.addCob(fromTime, now, useCobForScale, if (useCobForScale) 1.0 else 0.5)
|
||||
if (menuChartSettings[g + 1][OverviewMenus.CharType.DEV.ordinal]) secondGraphData.addDeviations(fromTime, now, useDevForScale, 1.0, alignDevBgiScale)
|
||||
if (menuChartSettings[g + 1][OverviewMenus.CharType.BGI.ordinal]) secondGraphData.addMinusBGI(fromTime, endTime, useBGIForScale, if (alignDevBgiScale) 1.0 else 0.8, alignDevBgiScale)
|
||||
if (menuChartSettings[g + 1][OverviewMenus.CharType.SEN.ordinal]) secondGraphData.addRatio(fromTime, now, useRatioForScale, 1.0)
|
||||
if (menuChartSettings[g + 1][OverviewMenus.CharType.SEN.ordinal]) secondGraphData.addRatio(fromTime, now, useRatioForScale, if (useRatioForScale) 1.0 else 0.8)
|
||||
if (menuChartSettings[g + 1][OverviewMenus.CharType.DEVSLOPE.ordinal] && buildHelper.isDev()) secondGraphData.addDeviationSlope(fromTime, now, useDSForScale, 1.0)
|
||||
|
||||
// set manual x bounds to have nice steps
|
||||
|
|
|
@ -567,11 +567,11 @@ class GraphData(
|
|||
val ratioArray: MutableList<ScaledDataPoint> = ArrayList()
|
||||
var maxRatioValueFound = 5.0 //even if sens data equals 0 for all the period, minimum scale is between 95% and 105%
|
||||
var minRatioValueFound = - maxRatioValueFound
|
||||
val ratioScale = Scale()
|
||||
val ratioScale = if (useForScale) Scale(100.0) else Scale()
|
||||
var time = fromTime
|
||||
while (time <= toTime) {
|
||||
iobCobCalculatorPlugin.getAutosensData(time)?.let { autosensData ->
|
||||
ratioArray.add(ScaledDataPoint(time, 100.0 * (autosensData.autosensResult.ratio), ratioScale))
|
||||
ratioArray.add(ScaledDataPoint(time, 100.0 * (autosensData.autosensResult.ratio - 1 ), ratioScale))
|
||||
maxRatioValueFound = max(maxRatioValueFound, 100.0 * (autosensData.autosensResult.ratio - 1))
|
||||
minRatioValueFound = min(minRatioValueFound, 100.0 * (autosensData.autosensResult.ratio - 1))
|
||||
}
|
||||
|
@ -586,8 +586,9 @@ class GraphData(
|
|||
if (useForScale) {
|
||||
maxY = 100.0 + max(maxRatioValueFound, abs(minRatioValueFound))
|
||||
minY = 100.0 - max(maxRatioValueFound, abs(minRatioValueFound))
|
||||
}
|
||||
ratioScale.setMultiplier(maxY * scale / max(maxRatioValueFound, abs(minRatioValueFound)))
|
||||
ratioScale.setMultiplier(1.0)
|
||||
} else
|
||||
ratioScale.setMultiplier(maxY * scale / max(maxRatioValueFound, abs(minRatioValueFound)))
|
||||
}
|
||||
|
||||
// scale in % of vertical size (like 0.3)
|
||||
|
|
Loading…
Reference in a new issue