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
14 changes: 12 additions & 2 deletions ios/Tipsarr/Tipsarr/Features/Admin/StatsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -152,16 +152,26 @@ struct StatsView: View {
private func buckets(_ list: [StatsBucket], byHours: Bool) -> some View {
let top = Array(list.prefix(8))
return Chart(top) { item in
BarMark(x: .value("v", byHours && item.hours > 0 ? item.hours : Double(item.titles)), y: .value("Name", item.name))
BarMark(x: .value("v", byHours && item.hours > 0 ? item.hours : Double(item.titles)), y: .value("Name", item.name), height: .fixed(16))
.foregroundStyle(Tokens.palette.primary)
.clipShape(.rect(cornerRadius: 3))
.annotation(position: .trailing) {
Text(verbatim: byHours && item.hours > 0 ? StatsFormat.hours(item.hours) : L10n.string("stats.n_titles", String(item.titles)))
.font(.caption2).foregroundStyle(Tokens.palette.mutedFg)
}
}
.chartYScale(domain: top.map(\.name))
.chartXAxis(.hidden)
.frame(height: CGFloat(top.count) * 30 + 20)
// Labels only: the default category marks draw a gridline through each label
// and can wrap the label above its bar.
.chartYAxis {
AxisMarks(position: .leading) { _ in
AxisValueLabel(horizontalSpacing: Tokens.Spacing.sm, verticalSpacing: 0)
.font(.caption).foregroundStyle(Tokens.palette.fg)
}
}
.chartPlotStyle { $0.padding(.trailing, 56) }
.frame(height: CGFloat(top.count) * 30 + 8)
}

private func monthsChart(_ months: [StatsMonth]) -> some View {
Expand Down
Loading