From af8ad1734332350824de15ab89f2371daaf33037 Mon Sep 17 00:00:00 2001 From: Rombond Date: Thu, 12 Nov 2026 14:24:06 -0500 Subject: [PATCH] fix(ios): stats genre/decade bar charts layout Horizontal bucket charts used default category axis marks, which draw a gridline through each label and let long labels wrap above the bar. Use label-only leading axis marks, fixed bar height, and trailing room for the value annotations. --- ios/Tipsarr/Tipsarr/Features/Admin/StatsView.swift | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/ios/Tipsarr/Tipsarr/Features/Admin/StatsView.swift b/ios/Tipsarr/Tipsarr/Features/Admin/StatsView.swift index 97e9f45f..0be431de 100644 --- a/ios/Tipsarr/Tipsarr/Features/Admin/StatsView.swift +++ b/ios/Tipsarr/Tipsarr/Features/Admin/StatsView.swift @@ -152,8 +152,9 @@ 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) @@ -161,7 +162,16 @@ struct StatsView: View { } .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 {