3.1 KiB
3.1 KiB
title, tags
| title | tags | ||||
|---|---|---|---|---|---|
| Statistics |
|
Statistics
Overview
The Dashboard page shows 7 chart components, combining backend statistics endpoints with client-side library store computations.
Charts
WatchActivityChart
- Type: Area chart (Recharts)
- Data: Monthly watch count for a selected year
- Source:
GET /statistics/watch-count/year/:year→ Hooks#useStatistics - File:
components/dashboard/WatchActivityChart.tsx
WatchTimeChart
- Type: Area chart
- Data: Monthly watch time (hours) for a selected year
- Source:
GET /statistics/watch-time/year/:year→ Hooks#useStatistics - File:
components/dashboard/WatchTimeChart.tsx
CouchDayChart
- Type: Bar chart
- Data: Watch distribution by day of week
- Source:
GET /statistics/watch-weekday→ Hooks#useStatistics - File:
components/dashboard/CouchDayChart.tsx
[!important] Accuracy Filter Only counts records where
accuracy = 'EXACT'. Estimated and unknown dates are excluded to prevent skewing day-of-week patterns. See Watch Tracking#Accuracy System.
Backend query (statisticsController.js):
- Queries both
EpisodeSeenandEntrySeenwithWHERE accuracy = 'EXACT' - Groups by
DAYOFWEEK(date_seen)(1=Sunday → 7=Saturday) - Sums counts from both tables
LibraryGrowthChart
- Type: Area chart
- Data: Cumulative library growth over time
- Source: Client-side computation from Stores
- File:
components/dashboard/LibraryGrowthChart.tsx
Details:
- Uses
createdAtfield as entry date (when it was added to Showy) - Includes all entries (library + watchlist)
- Supports year filter dropdown + "All" option
- "All" mode: monthly data across all years
- Year mode: monthly data for selected year, with cumulative count starting from entries before that year
MediaTypeChart
- Type: Chart showing movies vs TV breakdown
- Source: Client-side from library store
- File:
components/dashboard/MediaTypeChart.tsx
TopGenresChart
- Type: Chart showing top genres by count
- Source: Client-side from library store
- File:
components/dashboard/TopGenresChart.tsx
RatingsChart
- Type: Chart showing ratings distribution
- Source: Client-side from library store
- File:
components/dashboard/RatingsChart.tsx
Backend Endpoints
| Endpoint | Returns |
|---|---|
GET /statistics/watch-time |
All-time total minutes (series + movies) |
GET /statistics/watch-time/year/:year |
Monthly watch minutes for year |
GET /statistics/watch-count/year/:year |
Monthly watch counts for year |
GET /statistics/watch-weekday |
Day-of-week distribution (EXACT only) |
Important Files
| File | Role |
|---|---|
backend/controllers/statisticsController.js |
Backend queries |
react_frontend/src/components/dashboard/ |
All 7 chart components |
react_frontend/src/hooks/useStatistics.ts |
Query hooks |
react_frontend/src/api/statistics.ts |
API client |