Use brightest color for checkerboard when only one is available - #47129
Conversation
There was a problem hiding this comment.
Pull request overview
Fixes Dashboard checkerboard relative scaling so that when all non-zero cells share the same value (min === max), they render at the brightest color level instead of collapsing to the dimmest level. This aligns the UI with the expected behavior in #47128 for charts like “Hosts online” when filtered down to a single host.
Changes:
- Update relative-scale color-level calculation to return level 5 when the non-zero range is 0.
- Add a regression test covering the single-distinct-value relative-scale case.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| frontend/pages/DashboardPage/cards/ChartCard/CheckerboardViz.tsx | Adjusts relative-scale color selection to use brightest level when min/max are equal. |
| frontend/pages/DashboardPage/cards/ChartCard/CheckerboardViz.tests.tsx | Adds automated coverage to prevent regressions when relativeScale has only one distinct non-zero value. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #47129 +/- ##
========================================
Coverage 67.17% 67.17%
========================================
Files 2908 2911 +3
Lines 226136 226147 +11
Branches 11829 11683 -146
========================================
+ Hits 151898 151906 +8
- Misses 60508 60512 +4
+ Partials 13730 13729 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
WalkthroughThis PR fixes a bug in the CheckerboardViz component where cells with uniform non-zero values were rendered in the dimmest color instead of the brightest. The implementation removes a divide-by-zero workaround ( Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
Related issue: Resolves #47128
Checklist for submitter
If some of the following don't apply, delete the relevant line.
changes/,orbit/changes/oree/fleetd-chrome/changes.See Changes files for more information.
n/a, unreleased
Testing
on main:
on branch:

For unreleased bug fixes in a release candidate, one of:
Summary by CodeRabbit