This commit is contained in:
Milos Kozak 2021-05-27 13:37:06 +02:00
commit 2845bc8714
3 changed files with 20 additions and 5 deletions

View file

@ -779,7 +779,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)

View file

@ -113,6 +113,9 @@ class OverviewMenus @Inject constructor(
if (m == CharType.PRE) insert = predictionsAvailable
if (m == CharType.DEVSLOPE) insert = buildHelper.isDev()
if (used.contains(m.ordinal)) insert = false
for (g2 in g + 1 until numOfGraphs) {
if (settingsCopy[g2][m.ordinal]) insert = false
}
if (insert) {
val item = popup.menu.add(Menu.NONE, m.ordinal + 100 * (g + 1), Menu.NONE, resourceHelper.gs(m.nameId))
val title = item.title

View file

@ -154,19 +154,31 @@ class GraphData(
maxY = 100.0 + max(overviewData.maxRatioValueFound, abs(overviewData.minRatioValueFound))
minY = 100.0 - max(overviewData.maxRatioValueFound, abs(overviewData.minRatioValueFound))
overviewData.ratioScale.multiplier = 1.0
} else
overviewData.ratioScale.shift = 100.0
} else {
overviewData.ratioScale.multiplier = maxY * scale / max(overviewData.maxRatioValueFound, abs(overviewData.minRatioValueFound))
overviewData.ratioScale.shift = 0.0
}
addSeries(overviewData.ratioSeries)
}
// 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.multiplier = maxY * scale / overviewData.maxFromMaxValueFound
overviewData.dsMinScale.multiplier = maxY * scale / overviewData.maxFromMinValueFound
var graphMaxY = maxY
if (isRatioScale) {
graphMaxY = maxY - 100.0
overviewData.dsMinScale.shift = 100.0
overviewData.dsMaxScale.shift = 100.0
} else {
overviewData.dsMinScale.shift = 0.0
overviewData.dsMaxScale.shift = 0.0
}
overviewData.dsMaxScale.multiplier = graphMaxY * scale / overviewData.maxFromMaxValueFound
overviewData.dsMinScale.multiplier = graphMaxY * scale / overviewData.maxFromMinValueFound
addSeries(overviewData.dsMaxSeries)
addSeries(overviewData.dsMinSeries)
}