[Bug]: Mobile usage chart bars are rounded at the bottom instead of the top (Android)#15811
Area
apps/mobile
Steps to reproduce
- Open the mobile app on Android and connect to an environment with usage data.
- Open Usage and look at the daily bar chart (30d, Cost or Tokens).
Expected behavior
Each bar's rounded corners are at its top, where the bar ends.
Actual behavior
The rounding is upside down. Bars have rounded bottom corners at the baseline and flat, square tops.
Likely cause: in apps/mobile/src/features/usage/UsageDailyChart.tsx (the non-iOS fallback), rounded-sm + overflow-hidden sit on a column that is h-full. The column always fills the whole chart height, so its top corners are rounded far above the visible bar (where nothing is drawn) and only the bottom corners clip anything. Rounding the top of the topmost segment, or sizing the column to the bar's total height instead of h-full, should fix it. iOS uses Swift Charts (UsageDailyChart.ios.tsx) and is probably not affected.
Impact
Cosmetic issue
Version or commit
main @ bf3be75c4
Environment
Android (Samsung), mobile app
Screenshots
Note
Grok responding on behalf of Julius.
Triage
Thanks @tntuser77 for the precise report. Your layout explanation matches the code.
What I found
- This reproduces on current
main(efecd3cf8).apps/mobile/src/features/usage/UsageDailyChart.tsxhasn't changed since the mobile usage dashboard landed in #5743. I didn't find another report of this. - This is the non-iOS chart. iOS uses
UsageDailyChart.ios.tsx(Swift Charts withbarStyle.cornerRadius: 2), so Android and any other platform without that.iosfile render this view. - Each day is a full-height column (
h-full) withoverflow-hidden rounded-sm. The segments stack up from the baseline withflex-col-reverse, and their combined height is(day.total / max) * height. Because the rounding is on the full-height column, it clips the column's corners instead of the top of the painted bar:- A bar shorter than the tallest one only reaches those corners at the baseline, so it ends up rounded at the bottom and square at the top.
- The tallest day fills the whole column, so that one bar is rounded at both the top and the bottom.
- It's cosmetic. The totals aren't affected.
- The screenshot mentioned in the report isn't on the issue yet. If the tallest bar is also square across the top, a screenshot would help, since that would point to a separate clipping problem.
Likely fix area
Options a maintainer could weigh:
- Inner stack wrapper (preferred): keep a full-height slot for each day so the columns stay aligned. Put the segments in an inner view that's only as tall as the stack, sitting on the baseline, and give it
overflow-hiddenplus a top-only radius (rounded-t-sm). This works for single-provider bars and stacked bars alike. - Lighter variants that fall short: two simpler versions of the report's suggestion don't fully give the expected look.
- Putting
rounded-smon a column shortened to the stack height still rounds the baseline. - Putting
rounded-smon only the top segment also rounds the edge where that segment meets the one below it.
- Putting
A maintainer will decide on the fix direction.