fix basal rendering
This commit is contained in:
parent
2f928ad548
commit
17bbcf0e3e
|
@ -251,7 +251,6 @@ class OverviewData @Inject constructor(
|
|||
var bgReadingGraphSeries: PointsWithLabelGraphSeries<DataPointWithLabelInterface> = PointsWithLabelGraphSeries()
|
||||
var predictionsGraphSeries: PointsWithLabelGraphSeries<DataPointWithLabelInterface> = PointsWithLabelGraphSeries()
|
||||
|
||||
var maxBasalValueFound = 0.0
|
||||
val basalScale = Scale()
|
||||
var baseBasalGraphSeries: LineGraphSeries<ScaledDataPoint> = LineGraphSeries()
|
||||
var tempBasalGraphSeries: LineGraphSeries<ScaledDataPoint> = LineGraphSeries()
|
||||
|
|
|
@ -73,13 +73,17 @@ class GraphData(
|
|||
}
|
||||
|
||||
fun addBasals() {
|
||||
maxY = max(maxY, defaultValueHelper.determineHighLine())
|
||||
val scale = defaultValueHelper.determineLowLine() / maxY / 1.2
|
||||
overviewData.basalScale.multiplier = 1.0 // get unscaled Y-values for max calculation
|
||||
var maxBasalValue = maxOf(0.1, overviewData.baseBasalGraphSeries.highestValueY, overviewData.tempBasalGraphSeries.highestValueY)
|
||||
maxBasalValue = maxOf(maxBasalValue, overviewData.basalLineGraphSeries.highestValueY, overviewData.absoluteBasalGraphSeries.highestValueY)
|
||||
addSeries(overviewData.baseBasalGraphSeries)
|
||||
addSeries(overviewData.tempBasalGraphSeries)
|
||||
addSeries(overviewData.basalLineGraphSeries)
|
||||
addSeries(overviewData.absoluteBasalGraphSeries)
|
||||
overviewData.basalScale.multiplier = maxY * scale / overviewData.maxBasalValueFound
|
||||
maxY = max(maxY, defaultValueHelper.determineHighLine())
|
||||
val scale = defaultValueHelper.determineLowLine() / maxY / 1.2
|
||||
overviewData.basalScale.multiplier = maxY * scale / maxBasalValue
|
||||
aapsLogger.debug("XXXXXX maxY:$maxY maxBasalValueFound:${maxBasalValue} multiplier:${overviewData.basalScale.multiplier}")
|
||||
}
|
||||
|
||||
fun addTargetLine() {
|
||||
|
|
|
@ -47,7 +47,6 @@ class PrepareBasalDataWorker(
|
|||
?: return Result.failure(workDataOf("Error" to "missing input data"))
|
||||
|
||||
rxBus.send(EventIobCalculationProgress(CalculationWorkflow.ProgressData.PREPARE_BASAL_DATA, 0, null))
|
||||
data.overviewData.maxBasalValueFound = 0.0
|
||||
val baseBasalArray: MutableList<ScaledDataPoint> = ArrayList()
|
||||
val tempBasalArray: MutableList<ScaledDataPoint> = ArrayList()
|
||||
val basalLineArray: MutableList<ScaledDataPoint> = ArrayList()
|
||||
|
@ -104,7 +103,6 @@ class PrepareBasalDataWorker(
|
|||
lastAbsoluteLineBasal = absoluteLineValue
|
||||
lastLineBasal = baseBasalValue
|
||||
lastTempBasal = tempBasalValue
|
||||
data.overviewData.maxBasalValueFound = max(data.overviewData.maxBasalValueFound, max(tempBasalValue, baseBasalValue))
|
||||
time += 60 * 1000L
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package info.nightscout.androidaps.plugins.general.overview.graphExtensions
|
||||
|
||||
class Scale(var shift: Double = 0.0, var multiplier: Double = 0.0) {
|
||||
class Scale(var shift: Double = 0.0, var multiplier: Double = 1.0) {
|
||||
|
||||
fun transform(original: Double): Double {
|
||||
return original * multiplier + shift
|
||||
|
|
Loading…
Reference in a new issue