Convert status Message to Kotlin (+ associated null management in localInsightPlugin)

This commit is contained in:
Philoul 2021-05-23 10:50:37 +02:00
parent ea940ea165
commit 37bd7495fd
2 changed files with 6 additions and 2 deletions

View file

@ -268,7 +268,7 @@ class OverviewData @Inject constructor(
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()
var ratioScale = Scale()
var ratioSeries: LineGraphSeries<ScaledDataPoint> = LineGraphSeries()
var maxFromMaxValueFound = Double.MIN_VALUE

View file

@ -15,6 +15,7 @@ import info.nightscout.androidaps.logging.AAPSLogger
import info.nightscout.androidaps.plugins.general.overview.OverviewData
import info.nightscout.androidaps.plugins.general.overview.graphExtensions.AreaGraphSeries
import info.nightscout.androidaps.plugins.general.overview.graphExtensions.DoubleDataPoint
import info.nightscout.androidaps.plugins.general.overview.graphExtensions.Scale
import info.nightscout.androidaps.plugins.general.overview.graphExtensions.TimeAsXAxisLabelFormatter
import info.nightscout.androidaps.utils.DefaultValueHelper
import info.nightscout.androidaps.utils.Round
@ -153,9 +154,12 @@ class GraphData(
if (useForScale) {
maxY = 100.0 + max(overviewData.maxRatioValueFound, abs(overviewData.minRatioValueFound))
minY = 100.0 - max(overviewData.maxRatioValueFound, abs(overviewData.minRatioValueFound))
overviewData.ratioScale = Scale(100.0)
overviewData.ratioScale.setMultiplier(1.0)
} else
} else {
overviewData.ratioScale = Scale()
overviewData.ratioScale.setMultiplier(maxY * scale / max(overviewData.maxRatioValueFound, abs(overviewData.minRatioValueFound)))
}
addSeries(overviewData.ratioSeries)
}