Skip to content

fix(ui): daily cost trend chart not rendering bars#426

Merged
BYK merged 1 commit into
mainfrom
fix/daily-chart-rendering
May 20, 2026
Merged

fix(ui): daily cost trend chart not rendering bars#426
BYK merged 1 commit into
mainfrom
fix/daily-chart-rendering

Conversation

@BYK
Copy link
Copy Markdown
Owner

@BYK BYK commented May 20, 2026

Summary

Follow-up fix for #418 — the daily cost trend chart was rendering but bars had zero height, making them invisible.

Root Causes

  1. CSS layout bug: .day-col had no explicit height, so percentage-based height: X% on .day-bar resolved to auto (effectively 0px, leaving only min-height: 2px). The parent .daily-chart had height: 120px but it didn't propagate through the flex column.

  2. Zero-cost live sessions: The live session loop added entries with cost: 0 to today's bucket, inflating session count without contributing cost.

Fix

  • Give .day-col explicit height: 100% and justify-content: flex-end so bars anchor to the bottom
  • Switch from percentage bar heights to pixel heights calculated server-side (barMaxPx = 90, leaving room for the date label)
  • Add cost > 0 guard when bucketing live sessions
  • Add flex-shrink: 0 on bar and label to prevent compression

Two issues prevented the chart from displaying:

1. CSS: .day-col lacked explicit height, so percentage-based bar heights
   resolved to auto (0px). Fix: give .day-col height:100% and
   justify-content:flex-end, switch bars to pixel heights calculated
   server-side (max 90px) for reliability.

2. Data: live sessions with cost > 0 were correctly bucketed to today
   but the guard was missing, adding zero-cost entries. Add cost > 0
   check and improve the comment explaining why live sessions are
   always bucketed to today (historical estimates skip them).
@BYK BYK self-assigned this May 20, 2026
@BYK BYK merged commit f1ac5c7 into main May 20, 2026
10 checks passed
@BYK BYK deleted the fix/daily-chart-rendering branch May 20, 2026 12:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant