Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -325,26 +325,32 @@ class StatsViewModel(
reloadChart()
}

private fun recalcChartTypeForPair(
private fun recalcChartTypeForPair(
cat1: TrackingCategory,
cat2: TrackingCategory?,
currentType: ChartType
): ChartType {
val hiddenForTwoCats = cat2 != null &&
(currentType == ChartType.TRENDS || currentType == ChartType.TIME_SERIES)

if (!hiddenForTwoCats && isValidChartType(currentType, cat1, cat2)) return currentType
return when {

val newChartType = when {
cat1.isNumeric && cat2?.isNumeric == true -> ChartType.SCATTER
cat2 != null -> ChartType.DUAL_TIME_SERIES
cat1.isNumeric -> ChartType.TIME_SCATTER
else -> ChartType.TRENDS
} // <-- The missing brace!

preferencesStore?.let { store ->
viewModelScope.launch {
store.setStatsCategory1Id(-1L)
store.setStatsCategory2Id(-1L)
store.setStatsChartType("")
}
}

return newChartType
}

fun setTimeRange(range: TimeRange) {
Expand Down
Loading