Skip to content

Commit

Permalink
Feat: Series list charts yRange matches series low and high scores
Browse files Browse the repository at this point in the history
  • Loading branch information
autoreleasefool committed Oct 10, 2023
1 parent ee31475 commit 7ef99cc
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion ios/Approach/Sources/SeriesListFeature/SeriesListItem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public struct SeriesListItem: View {
.chartXAxis(.hidden)
.chartYAxis(.hidden)
.chartLegend(.hidden)
.chartYScale(domain: 0...Game.MAXIMUM_SCORE)
.chartYScale(domain: series.scoreDomain)
.chartXScale(domain: 1...series.scores.count)
.frame(
width: contentSize.width * 0.9,
Expand Down Expand Up @@ -139,6 +139,14 @@ extension Series.List {
return nil
}
}

var scoreDomain: ClosedRange<Int> {
if let scoreRange {
return max(scoreRange.lowest - 10, 0)...min(scoreRange.highest + 10, Game.MAXIMUM_SCORE)
} else {
return 0...Game.MAXIMUM_SCORE
}
}
}

private struct ContentSizeKey: PreferenceKey, CGSizePreferenceKey {}
Expand Down

0 comments on commit 7ef99cc

Please sign in to comment.