Scale -> kt
This commit is contained in:
parent
309ce50518
commit
6e19d60796
3 changed files with 19 additions and 41 deletions
|
@ -76,7 +76,7 @@ class GraphData(
|
||||||
addSeries(overviewData.tempBasalGraphSeries)
|
addSeries(overviewData.tempBasalGraphSeries)
|
||||||
addSeries(overviewData.basalLineGraphSeries)
|
addSeries(overviewData.basalLineGraphSeries)
|
||||||
addSeries(overviewData.absoluteBasalGraphSeries)
|
addSeries(overviewData.absoluteBasalGraphSeries)
|
||||||
overviewData.basalScale.setMultiplier(maxY * scale / overviewData.maxBasalValueFound)
|
overviewData.basalScale.multiplier = maxY * scale / overviewData.maxBasalValueFound
|
||||||
}
|
}
|
||||||
|
|
||||||
fun addTargetLine() {
|
fun addTargetLine() {
|
||||||
|
@ -91,7 +91,7 @@ class GraphData(
|
||||||
fun addActivity(scale: Double) {
|
fun addActivity(scale: Double) {
|
||||||
addSeries(overviewData.activitySeries)
|
addSeries(overviewData.activitySeries)
|
||||||
addSeries(overviewData.activityPredictionSeries)
|
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
|
//Function below show -BGI to be able to compare curves with deviations
|
||||||
|
@ -100,7 +100,7 @@ class GraphData(
|
||||||
maxY = overviewData.maxBGIValue
|
maxY = overviewData.maxBGIValue
|
||||||
minY = -overviewData.maxBGIValue
|
minY = -overviewData.maxBGIValue
|
||||||
}
|
}
|
||||||
overviewData.bgiScale.setMultiplier(maxY * scale / overviewData.maxBGIValue)
|
overviewData.bgiScale.multiplier = maxY * scale / overviewData.maxBGIValue
|
||||||
addSeries(overviewData.minusBgiSeries)
|
addSeries(overviewData.minusBgiSeries)
|
||||||
addSeries(overviewData.minusBgiHistSeries)
|
addSeries(overviewData.minusBgiHistSeries)
|
||||||
}
|
}
|
||||||
|
@ -111,7 +111,7 @@ class GraphData(
|
||||||
maxY = overviewData.maxIobValueFound
|
maxY = overviewData.maxIobValueFound
|
||||||
minY = -overviewData.maxIobValueFound
|
minY = -overviewData.maxIobValueFound
|
||||||
}
|
}
|
||||||
overviewData.iobScale.setMultiplier(maxY * scale / overviewData.maxIobValueFound)
|
overviewData.iobScale.multiplier = maxY * scale / overviewData.maxIobValueFound
|
||||||
addSeries(overviewData.iobSeries)
|
addSeries(overviewData.iobSeries)
|
||||||
addSeries(overviewData.iobPredictions1Series)
|
addSeries(overviewData.iobPredictions1Series)
|
||||||
addSeries(overviewData.iobPredictions2Series)
|
addSeries(overviewData.iobPredictions2Series)
|
||||||
|
@ -123,7 +123,7 @@ class GraphData(
|
||||||
maxY = overviewData.maxIobValueFound
|
maxY = overviewData.maxIobValueFound
|
||||||
minY = -overviewData.maxIobValueFound
|
minY = -overviewData.maxIobValueFound
|
||||||
}
|
}
|
||||||
overviewData.iobScale.setMultiplier(maxY * scale / overviewData.maxIobValueFound)
|
overviewData.iobScale.multiplier = maxY * scale / overviewData.maxIobValueFound
|
||||||
addSeries(overviewData.absIobSeries)
|
addSeries(overviewData.absIobSeries)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,7 +133,7 @@ class GraphData(
|
||||||
maxY = overviewData.maxCobValueFound
|
maxY = overviewData.maxCobValueFound
|
||||||
minY = 0.0
|
minY = 0.0
|
||||||
}
|
}
|
||||||
overviewData.cobScale.setMultiplier(maxY * scale / overviewData.maxCobValueFound)
|
overviewData.cobScale.multiplier = maxY * scale / overviewData.maxCobValueFound
|
||||||
addSeries(overviewData.cobSeries)
|
addSeries(overviewData.cobSeries)
|
||||||
addSeries(overviewData.cobMinFailOverSeries)
|
addSeries(overviewData.cobMinFailOverSeries)
|
||||||
}
|
}
|
||||||
|
@ -144,7 +144,7 @@ class GraphData(
|
||||||
maxY = overviewData.maxDevValueFound
|
maxY = overviewData.maxDevValueFound
|
||||||
minY = -maxY
|
minY = -maxY
|
||||||
}
|
}
|
||||||
overviewData.devScale.setMultiplier(maxY * scale / overviewData.maxDevValueFound)
|
overviewData.devScale.multiplier = maxY * scale / overviewData.maxDevValueFound
|
||||||
addSeries(overviewData.deviationsSeries)
|
addSeries(overviewData.deviationsSeries)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -153,9 +153,9 @@ class GraphData(
|
||||||
if (useForScale) {
|
if (useForScale) {
|
||||||
maxY = 100.0 + max(overviewData.maxRatioValueFound, abs(overviewData.minRatioValueFound))
|
maxY = 100.0 + max(overviewData.maxRatioValueFound, abs(overviewData.minRatioValueFound))
|
||||||
minY = 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
|
} 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)
|
addSeries(overviewData.ratioSeries)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -165,8 +165,8 @@ class GraphData(
|
||||||
maxY = max(overviewData.maxFromMaxValueFound, overviewData.maxFromMinValueFound)
|
maxY = max(overviewData.maxFromMaxValueFound, overviewData.maxFromMinValueFound)
|
||||||
minY = -maxY
|
minY = -maxY
|
||||||
}
|
}
|
||||||
overviewData.dsMaxScale.setMultiplier(maxY * scale / overviewData.maxFromMaxValueFound)
|
overviewData.dsMaxScale.multiplier = maxY * scale / overviewData.maxFromMaxValueFound
|
||||||
overviewData.dsMinScale.setMultiplier(maxY * scale / overviewData.maxFromMinValueFound)
|
overviewData.dsMinScale.multiplier = maxY * scale / overviewData.maxFromMinValueFound
|
||||||
addSeries(overviewData.dsMaxSeries)
|
addSeries(overviewData.dsMaxSeries)
|
||||||
addSeries(overviewData.dsMinSeries)
|
addSeries(overviewData.dsMinSeries)
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue