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