diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/graphData/GraphData.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/graphData/GraphData.kt index ba3e33667f..da8e1e92a2 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/graphData/GraphData.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/graphData/GraphData.kt @@ -76,7 +76,7 @@ class GraphData( addSeries(overviewData.tempBasalGraphSeries) addSeries(overviewData.basalLineGraphSeries) addSeries(overviewData.absoluteBasalGraphSeries) - overviewData.basalScale.setMultiplier(maxY * scale / overviewData.maxBasalValueFound) + overviewData.basalScale.multiplier = maxY * scale / overviewData.maxBasalValueFound } fun addTargetLine() { @@ -91,7 +91,7 @@ class GraphData( fun addActivity(scale: Double) { addSeries(overviewData.activitySeries) addSeries(overviewData.activityPredictionSeries) - overviewData.actScale.setMultiplier(maxY * scale / overviewData.maxIAValue) + overviewData.actScale.multiplier = maxY * scale / overviewData.maxIAValue } //Function below show -BGI to be able to compare curves with deviations @@ -100,7 +100,7 @@ class GraphData( maxY = overviewData.maxBGIValue minY = -overviewData.maxBGIValue } - overviewData.bgiScale.setMultiplier(maxY * scale / overviewData.maxBGIValue) + overviewData.bgiScale.multiplier = maxY * scale / overviewData.maxBGIValue addSeries(overviewData.minusBgiSeries) addSeries(overviewData.minusBgiHistSeries) } @@ -111,7 +111,7 @@ class GraphData( maxY = overviewData.maxIobValueFound minY = -overviewData.maxIobValueFound } - overviewData.iobScale.setMultiplier(maxY * scale / overviewData.maxIobValueFound) + overviewData.iobScale.multiplier = maxY * scale / overviewData.maxIobValueFound addSeries(overviewData.iobSeries) addSeries(overviewData.iobPredictions1Series) addSeries(overviewData.iobPredictions2Series) @@ -123,7 +123,7 @@ class GraphData( maxY = overviewData.maxIobValueFound minY = -overviewData.maxIobValueFound } - overviewData.iobScale.setMultiplier(maxY * scale / overviewData.maxIobValueFound) + overviewData.iobScale.multiplier = maxY * scale / overviewData.maxIobValueFound addSeries(overviewData.absIobSeries) } @@ -133,7 +133,7 @@ class GraphData( maxY = overviewData.maxCobValueFound minY = 0.0 } - overviewData.cobScale.setMultiplier(maxY * scale / overviewData.maxCobValueFound) + overviewData.cobScale.multiplier = maxY * scale / overviewData.maxCobValueFound addSeries(overviewData.cobSeries) addSeries(overviewData.cobMinFailOverSeries) } @@ -144,7 +144,7 @@ class GraphData( maxY = overviewData.maxDevValueFound minY = -maxY } - overviewData.devScale.setMultiplier(maxY * scale / overviewData.maxDevValueFound) + overviewData.devScale.multiplier = maxY * scale / overviewData.maxDevValueFound addSeries(overviewData.deviationsSeries) } @@ -153,9 +153,9 @@ class GraphData( if (useForScale) { maxY = 100.0 + max(overviewData.maxRatioValueFound, abs(overviewData.minRatioValueFound)) minY = 100.0 - max(overviewData.maxRatioValueFound, abs(overviewData.minRatioValueFound)) - overviewData.ratioScale.setMultiplier(1.0) + overviewData.ratioScale.multiplier = 1.0 } else - overviewData.ratioScale.setMultiplier(maxY * scale / max(overviewData.maxRatioValueFound, abs(overviewData.minRatioValueFound))) + overviewData.ratioScale.multiplier = maxY * scale / max(overviewData.maxRatioValueFound, abs(overviewData.minRatioValueFound)) addSeries(overviewData.ratioSeries) } @@ -165,8 +165,8 @@ class GraphData( maxY = max(overviewData.maxFromMaxValueFound, overviewData.maxFromMinValueFound) minY = -maxY } - overviewData.dsMaxScale.setMultiplier(maxY * scale / overviewData.maxFromMaxValueFound) - overviewData.dsMinScale.setMultiplier(maxY * scale / overviewData.maxFromMinValueFound) + overviewData.dsMaxScale.multiplier = maxY * scale / overviewData.maxFromMaxValueFound + overviewData.dsMinScale.multiplier = maxY * scale / overviewData.maxFromMinValueFound addSeries(overviewData.dsMaxSeries) addSeries(overviewData.dsMinSeries) } diff --git a/core/src/main/java/info/nightscout/androidaps/plugins/general/overview/graphExtensions/Scale.java b/core/src/main/java/info/nightscout/androidaps/plugins/general/overview/graphExtensions/Scale.java deleted file mode 100644 index 53fa04af6b..0000000000 --- a/core/src/main/java/info/nightscout/androidaps/plugins/general/overview/graphExtensions/Scale.java +++ /dev/null @@ -1,30 +0,0 @@ -package info.nightscout.androidaps.plugins.general.overview.graphExtensions; - -/** - * Created by mike on 18.10.2017. - */ - -public class Scale { - private double multiplier; - private final double shift; - - public Scale() { - shift = 0; - } - - public Scale(double shift) { - this.shift = shift; - } - - public void setMultiplier(double value) { - this.multiplier = value; - } - - public double transform(double original) { - return original * multiplier + shift; - } - - public double getShift() { - return shift; - } -} diff --git a/core/src/main/java/info/nightscout/androidaps/plugins/general/overview/graphExtensions/Scale.kt b/core/src/main/java/info/nightscout/androidaps/plugins/general/overview/graphExtensions/Scale.kt new file mode 100644 index 0000000000..0c11b7e285 --- /dev/null +++ b/core/src/main/java/info/nightscout/androidaps/plugins/general/overview/graphExtensions/Scale.kt @@ -0,0 +1,8 @@ +package info.nightscout.androidaps.plugins.general.overview.graphExtensions + +class Scale(var shift: Double = 0.0, var multiplier: Double = 0.0) { + + fun transform(original: Double): Double { + return original * multiplier + shift + } +} \ No newline at end of file