Skip to content

feat(web): Chart usage by hour for ranges up to 7 days - #124

Merged
4ndreello merged 1 commit into
mainfrom
feat/usage-hourly-chart
Sep 25, 2026
Merged

4ndreello merged 1 commit into
mainfrom
feat/usage-hourly-chart

Conversation

@4ndreello

Copy link
Copy Markdown
Owner

Chart usage by hour when the range is 7 days or less, so Today and Last 3/7 days show a real curve.

Today used to render a single dot with a "pick a longer range" caption, and 3-day ranges drew a straight line between three daily points. The usage query now also returns byHour (local-time buckets keyed YYYY-MM-DD HH), and the page picks hourly rows for short ranges and daily rows beyond 7 days.

In the hourly chart:

  • empty hours are zero-filled from the first day through the current hour
  • a vertical divider marks each day, with 6h/12h/18h ticks
  • the current hour is still accumulating, so its segment is dashed and the hover label says · partial, to avoid reading a drop that did not happen
  • point dots are hidden (72 points is noisy) and only the hovered point shows one

The KPI sparklines use the same rows, so on Today they show the day's curve instead of a flat line.

byHour is optional in the protocol: a web page talking to an older daemon falls back to the daily chart.

Worth knowing when reviewing: spend is bucketed by the session's created_at, so backfilled sessions can pile up at 00h. That was already true for daily buckets and is just more visible per hour.

Today rendered a single dot and short ranges drew a straight line between
daily points. The usage query now returns local hourly buckets and the
chart uses them for ranges of 7 days or less, with day dividers and a
dashed segment for the still-accumulating current hour.
@sonarqubecloud

Copy link
Copy Markdown

@4ndreello
4ndreello marked this pull request as ready for review September 25, 2026 02:52
@4ndreello
4ndreello merged commit 68337ba into main Sep 25, 2026
4 checks passed
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