Skip to content

feat: added match-based X-axis toggle for VR History Graph#253

Merged
patchzyy merged 1 commit intoTeamWheelWizard:devfrom
tinfoil766:main
Apr 23, 2026
Merged

feat: added match-based X-axis toggle for VR History Graph#253
patchzyy merged 1 commit intoTeamWheelWizard:devfrom
tinfoil766:main

Conversation

@tinfoil766
Copy link
Copy Markdown

@tinfoil766 tinfoil766 commented Apr 14, 2026

Purpose of this PR

The VR History graph previously only used time for the X-axis.

This adds a toggle to switch the X-axis to “Matches,” making it easier to see how VR changes per game.

How to Test

  • Go to the VR History section on a player profile
  • Find the new “Matches” toggle in the header (next to the date range dropdown) and click it on and off

What Changed

  • Added a switch (CheckBox) to the VrHistoryGraph.axaml header
  • Updated ApplyHistoryData to support both time-based and match-based X-axis
  • Switched X-axis labels dynamically between dates and match numbers
  • Cached the last response so toggling doesn’t require a new API call

Related Issue

N/A (feature request)

Checklist before merging

  • Add relevant tests

Summary by CodeRabbit

  • New Features

    • Added "Matches" toggle to the VR history graph header, allowing users to switch between time-based and match-based X-axis views of their VR performance history.
  • Style

    • Enhanced header layout with improved spacing and control alignment.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 14, 2026

📝 Walkthrough

Walkthrough

The VrHistoryGraph component gains a new UI toggle (UseMatchesAsXAxis checkbox) to switch between match-based and time-based X-axis display modes. The code-behind implements conditional axis label formatting and coordinate computation, with response caching to support dynamic axis switching.

Changes

Cohort / File(s) Summary
VrHistoryGraph UI Layout
WheelWizard/Views/Patterns/VrHistoryGraph.axaml
Added Spacing="10" and VerticalAlignment="Center" to header controls row; inserted new CheckBox with Classes="Switch" and Content="Matches" binding to UseMatchesAsXAxis.
VrHistoryGraph Logic & State
WheelWizard/Views/Patterns/VrHistoryGraph.axaml.cs
Introduced public UseMatchesAsXAxis property with PropertyChanged event; added _lastHistoryResponse cache to support dynamic axis switching; modified ApplyHistoryData to store responses and ResetGraph to clear cache; made x-axis label formatting and coordinate computation conditional based on toggle state.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 A toggle now twirls, both matches and time,
The X-axis dances in rhythm and rhyme!
With checkboxes clicked and coordinates aligned,
The history graph shifts—what wonders we'll find!

🚥 Pre-merge checks | ✅ 2 | ❌ 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 (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and concisely summarizes the main change: adding a match-based X-axis toggle for the VR History Graph.
Description check ✅ Passed The pull request description follows the required template structure and includes all major sections: Purpose, How to Test, What Changed, Related Issue, and Checklist. The description is clear and specific.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@WheelWizard/Views/Patterns/VrHistoryGraph.axaml.cs`:
- Around line 431-463: Add regression tests for VrHistoryGraph's X-axis
branching (UseMatchesAsXAxis true/false) exercising 1-point, 2-point, and
multi-point orderedByDate scenarios: create test fixtures that set orderedByDate
with 1, 2, and >2 entries, toggle UseMatchesAsXAxis, call the code path that
computes GraphStartLabel/GraphMidLabel/GraphEndLabel and the point projection
logic (the lambda producing Point(x,y)), and assert expected label strings and x
coordinates (for matches: 0, mid = i/(n-1)*GraphWidth etc.; for time axis:
computed from graphStart/graphEnd and totalSeconds). Cover boundary
vrRange/minVr cases to ensure y calculation (GraphHeight - (entry.TotalVr -
minVr)/vrRange*GraphHeight) handles zero/one ranges without division-by-zero or
NaN by asserting y values and behavior.
- Around line 59-73: The toggle setter for UseMatchesAsXAxis currently
re-applies cached _lastHistoryResponse even when a reload is in progress; update
the setter to skip calling ApplyHistoryData(_lastHistoryResponse,
_selectedHistoryDays) when IsLoading is true (or when a backing flag like
_isLoading indicates an active load), or clear/ignore _lastHistoryResponse
during loads so stale data isn't rendered; specifically modify the
UseMatchesAsXAxis setter to check IsLoading (or _isLoading) before invoking
ApplyHistoryData and only apply cached data when not loading.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 2014e141-5eb9-440d-9d3c-28d74cbae710

📥 Commits

Reviewing files that changed from the base of the PR and between 0942f1e and 6fd073f.

📒 Files selected for processing (2)
  • WheelWizard/Views/Patterns/VrHistoryGraph.axaml
  • WheelWizard/Views/Patterns/VrHistoryGraph.axaml.cs

Comment on lines +59 to +73
public bool UseMatchesAsXAxis
{
get => _useMatchesAsXAxis;
set
{
if (_useMatchesAsXAxis == value)
return;

_useMatchesAsXAxis = value;
OnPropertyChanged(nameof(UseMatchesAsXAxis));

if (_lastHistoryResponse != null)
ApplyHistoryData(_lastHistoryResponse, _selectedHistoryDays);
}
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Prevent stale cached data from being re-applied during active reloads.

At Line 70-Line 72, toggling can re-render _lastHistoryResponse while IsLoading is true, which can temporarily show stale data from a previous context with the newly selected range.

Suggested fix
 public bool UseMatchesAsXAxis
 {
     get => _useMatchesAsXAxis;
     set
     {
         if (_useMatchesAsXAxis == value)
             return;

         _useMatchesAsXAxis = value;
         OnPropertyChanged(nameof(UseMatchesAsXAxis));

-        if (_lastHistoryResponse != null)
+        if (!IsLoading && _lastHistoryResponse != null)
             ApplyHistoryData(_lastHistoryResponse, _selectedHistoryDays);
     }
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
public bool UseMatchesAsXAxis
{
get => _useMatchesAsXAxis;
set
{
if (_useMatchesAsXAxis == value)
return;
_useMatchesAsXAxis = value;
OnPropertyChanged(nameof(UseMatchesAsXAxis));
if (_lastHistoryResponse != null)
ApplyHistoryData(_lastHistoryResponse, _selectedHistoryDays);
}
}
public bool UseMatchesAsXAxis
{
get => _useMatchesAsXAxis;
set
{
if (_useMatchesAsXAxis == value)
return;
_useMatchesAsXAxis = value;
OnPropertyChanged(nameof(UseMatchesAsXAxis));
if (!IsLoading && _lastHistoryResponse != null)
ApplyHistoryData(_lastHistoryResponse, _selectedHistoryDays);
}
}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@WheelWizard/Views/Patterns/VrHistoryGraph.axaml.cs` around lines 59 - 73, The
toggle setter for UseMatchesAsXAxis currently re-applies cached
_lastHistoryResponse even when a reload is in progress; update the setter to
skip calling ApplyHistoryData(_lastHistoryResponse, _selectedHistoryDays) when
IsLoading is true (or when a backing flag like _isLoading indicates an active
load), or clear/ignore _lastHistoryResponse during loads so stale data isn't
rendered; specifically modify the UseMatchesAsXAxis setter to check IsLoading
(or _isLoading) before invoking ApplyHistoryData and only apply cached data when
not loading.

Comment thread WheelWizard/Views/Patterns/VrHistoryGraph.axaml.cs
patchzyy
patchzyy previously approved these changes Apr 23, 2026
@patchzyy patchzyy changed the base branch from main to dev April 23, 2026 16:57
@patchzyy patchzyy dismissed their stale review April 23, 2026 16:57

The base branch was changed.

@patchzyy patchzyy merged commit 9949825 into TeamWheelWizard:dev Apr 23, 2026
2 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.

2 participants