Fix Sens curve scale if alone on a graph
=> I also fix deviation slope curve if secondary behind Sens curve
This commit is contained in:
parent
b9a9a86739
commit
62c063a5bc
3 changed files with 15 additions and 6 deletions
|
@ -273,8 +273,8 @@ class OverviewData @Inject constructor(
|
|||
|
||||
var maxFromMaxValueFound = Double.MIN_VALUE
|
||||
var maxFromMinValueFound = Double.MIN_VALUE
|
||||
val dsMaxScale = Scale()
|
||||
val dsMinScale = Scale()
|
||||
var dsMaxScale = Scale()
|
||||
var dsMinScale = Scale()
|
||||
var dsMaxSeries: LineGraphSeries<ScaledDataPoint> = LineGraphSeries()
|
||||
var dsMinSeries: LineGraphSeries<ScaledDataPoint> = LineGraphSeries()
|
||||
|
||||
|
|
|
@ -780,7 +780,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
|
|||
if (menuChartSettings[g + 1][OverviewMenus.CharType.DEV.ordinal]) secondGraphData.addDeviations(useDevForScale, 1.0)
|
||||
if (menuChartSettings[g + 1][OverviewMenus.CharType.BGI.ordinal]) secondGraphData.addMinusBGI(useBGIForScale, if (alignDevBgiScale) 1.0 else 0.8)
|
||||
if (menuChartSettings[g + 1][OverviewMenus.CharType.SEN.ordinal]) secondGraphData.addRatio(useRatioForScale, if (useRatioForScale) 1.0 else 0.8)
|
||||
if (menuChartSettings[g + 1][OverviewMenus.CharType.DEVSLOPE.ordinal] && buildHelper.isDev()) secondGraphData.addDeviationSlope(useDSForScale, 1.0)
|
||||
if (menuChartSettings[g + 1][OverviewMenus.CharType.DEVSLOPE.ordinal] && buildHelper.isDev()) secondGraphData.addDeviationSlope(useDSForScale, if(useDSForScale) 1.0 else 0.8, useRatioForScale)
|
||||
|
||||
// set manual x bounds to have nice steps
|
||||
secondGraphData.formatAxis(overviewData.fromTime, overviewData.endTime)
|
||||
|
|
|
@ -164,13 +164,22 @@ class GraphData(
|
|||
}
|
||||
|
||||
// scale in % of vertical size (like 0.3)
|
||||
fun addDeviationSlope(useForScale: Boolean, scale: Double) {
|
||||
fun addDeviationSlope(useForScale: Boolean, scale: Double, isRatioScale: Boolean = false) {
|
||||
if (useForScale) {
|
||||
maxY = max(overviewData.maxFromMaxValueFound, overviewData.maxFromMinValueFound)
|
||||
minY = -maxY
|
||||
}
|
||||
overviewData.dsMaxScale.setMultiplier(maxY * scale / overviewData.maxFromMaxValueFound)
|
||||
overviewData.dsMinScale.setMultiplier(maxY * scale / overviewData.maxFromMinValueFound)
|
||||
var graphMaxY = maxY
|
||||
if (isRatioScale) {
|
||||
graphMaxY = maxY - 100.0
|
||||
overviewData.dsMinScale = Scale(100.0)
|
||||
overviewData.dsMaxScale = Scale(100.0)
|
||||
} else {
|
||||
overviewData.dsMinScale = Scale()
|
||||
overviewData.dsMaxScale = Scale()
|
||||
}
|
||||
overviewData.dsMaxScale.setMultiplier(graphMaxY * scale / overviewData.maxFromMaxValueFound)
|
||||
overviewData.dsMinScale.setMultiplier(graphMaxY * scale / overviewData.maxFromMinValueFound)
|
||||
addSeries(overviewData.dsMaxSeries)
|
||||
addSeries(overviewData.dsMinSeries)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue