Skip to content

fix: switch sessions chart from stacked to independent areas#560

Merged
ColeMurray merged 1 commit intomainfrom
fix/analytics-chart-unstacked
Apr 26, 2026
Merged

fix: switch sessions chart from stacked to independent areas#560
ColeMurray merged 1 commit intomainfrom
fix/analytics-chart-unstacked

Conversation

@ColeMurray
Copy link
Copy Markdown
Owner

@ColeMurray ColeMurray commented Apr 26, 2026

Summary

  • Removed stackId="sessions" from the timeseries <Area> components so each user gets an independent line from y=0 instead of stacking on top of each other
  • Filtered out groups with 0 total sessions from buildTimeseriesChartData to prevent phantom legend entries
  • Reduced area fill opacity (0.32→0.18 / 0.06→0.03) so overlapping areas remain legible

Problem: The stacked area chart caused misleading visuals. On any day where a user had 0 sessions, their stroke still rendered on top of the previous user's data at the cumulative height — making it look like they were the dominant contributor (e.g., "Unknown user" appearing as the highest green line despite having 0 sessions).

Fix: Independent (non-stacked) areas. Each user's line directly represents their session count. No stacking confusion, and the chart reads correctly for the typical 1-3 user single-tenant deployment.

Test plan

  • analytics.test.ts passes (8 tests)
  • Verify chart renders correctly on analytics dashboard with real data
  • Confirm overlapping areas are distinguishable with reduced opacity
  • Check tooltip still shows correct per-user counts on hover

Summary by CodeRabbit

  • Bug Fixes

    • Analytics chart now excludes data series with zero or negative totals
  • Style

    • Adjusted area chart gradient transparency for improved visibility
    • Removed stacking behavior from area series
    • Updated descriptive labels in analytics interface

Stacked area chart caused misleading visuals — users with 0 sessions on
a given day still rendered their stroke on top of other users' data,
making them appear as the dominant contributor. Independent areas show
each user's line from y=0 so the chart reads correctly. Fill opacity
reduced to keep overlapping areas legible.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 26, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 70f08350-9291-4ce9-8d5c-06500e954824

📥 Commits

Reviewing files that changed from the base of the PR and between 2261c57 and 4ef008e.

📒 Files selected for processing (2)
  • packages/web/src/components/analytics/timeseries-chart.tsx
  • packages/web/src/lib/analytics.ts

📝 Walkthrough

Walkthrough

This change modifies the analytics timeseries chart to filter out data series with non-positive total values and removes stacking from area series. The chart rendering becomes less visually dense through reduced gradient opacity, and UI labels are updated to reflect the unstacked visualization.

Changes

Cohort / File(s) Summary
Chart Rendering & UI
packages/web/src/components/analytics/timeseries-chart.tsx
Removed stacking group identifier from Area series, lowered gradient opacity values, and updated explanatory text to remove references to stacked behavior.
Data Aggregation
packages/web/src/lib/analytics.ts
Added filtering to exclude timeseries groups with zero or negative aggregated totals from the chart dataset.

Possibly related PRs

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes


🐰 Areas now flow free, no stacking here,
Zero totals fade, the view is clear,
Softer hues in gradients shine,
Charts now render, oh so fine!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly and accurately describes the main change: switching the sessions chart from stacked to independent areas, which is the core functional fix across both modified files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/analytics-chart-unstacked

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown

Terraform Validation Results

Step Status
Format
Init
Validate

Note: Terraform plan was skipped because secrets are not configured. This is expected for external contributors. See docs/GETTING_STARTED.md for setup instructions.

Pushed by: @ColeMurray, Action: pull_request

@ColeMurray ColeMurray merged commit c94e3cb into main Apr 26, 2026
18 checks passed
@ColeMurray ColeMurray deleted the fix/analytics-chart-unstacked branch April 26, 2026 04:54
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