claude-usage icon indicating copy to clipboard operation
claude-usage copied to clipboard

Feature: Hourly activity distribution chart with peak hours

Open ilia-pluzhnikov opened this issue 7 months ago • 1 comments

Feature Request: Hourly Activity Distribution Chart

Problem

Users can't see when during the day they're most active with Claude Code. The current dashboard shows daily totals but not intra-day patterns — which matters especially for users affected by Anthropic's peak hour throttling (Mon–Fri 05:00–11:00 PT).

Proposed Solution

Add an "Average Hourly Distribution" bar chart to the dashboard:

  • Average turns per hour (bar chart, left Y-axis)
  • Average output tokens per hour (line overlay, right Y-axis)
  • Hours 00:00–23:00 on X-axis
  • Respects existing Range and Model filters
  • Shows number of days in the average (e.g., "29 days")

Screenshot (prototype implementation)

Image

Additional Enhancements

1. Timezone toggle (Local / UTC) Transcripts store timestamps in UTC. A Local/UTC toggle lets users see hours in their own timezone. Browser's Intl.DateTimeFormat().resolvedOptions().timeZone detects it automatically.

2. Peak hours highlighting Anthropic throttles during Mon–Fri 05:00–11:00 PT (12:00–18:00 UTC). Visually mark these hours:

  • Red/distinct-colored bars for peak hours
  • ⚡ icon prefix on X-axis labels
  • Tooltip note: "Peak — Anthropic US hours"
  • Correctly shifts with Local/UTC toggle

Why This Is Useful

  • Helps users understand their usage patterns
  • Visualizes overlap with Anthropic's peak hours (when 5h session limits drain faster)
  • Enables shifting heavy workloads to off-peak for better rate limits
  • Especially valuable for users outside US timezones (Asia, Europe)

Implementation Notes

  • New SQL query grouping turns by substr(timestamp, 12, 2) for hour extraction
  • Data passed via /api/data as hourly_by_model array
  • Client-side aggregation with timezone shift using getTimezoneOffset()
  • Peak hours defined as UTC constants, converted via isPeakHour() helper
  • No new dependencies — uses existing Chart.js

ilia-pluzhnikov avatar Apr 09 '26 11:04 ilia-pluzhnikov

Implemented in #72.

What's in the PR:

  • New Average Hourly Distribution chart (bar + line, 24 hour buckets)
  • Local/UTC toggle using Intl.DateTimeFormat().resolvedOptions().timeZone (rounded to whole-hour offset for bucket alignment)
  • Peak-hour highlighting — red bars, ⚡ x-axis prefix, tooltip note. Peak set is UTC 12–17 (Mon–Fri 05:00–11:00 PT, PDT simplification) and shifts correctly under the toggle
  • Backend: hourly_by_model field on /api/data (day × UTC hour × model); client aggregates respecting existing Range + Model filters
  • Day-count indicator ("N days averaged · TZ")
  • No new dependencies — reuses Chart.js

Tests: +5 new (89 total passing). Manually verified rendering, range/model filtering, and Local↔UTC toggle in a real browser.

HaydenHaines avatar Apr 24 '26 01:04 HaydenHaines