MudChart: Allow clicking legend label to toggle series visibility - #13522
Merged
Conversation
added 2 commits
July 22, 2026 21:53
The MudText legend label now has a cursor-pointer class and an @OnClick handler that calls item.HandleCheckboxChangeAsync. This allows users to toggle the checkbox by clicking the label, improving usability beyond just clicking the checkbox itself.
Added three tests to BarChartTests.cs covering legend label behavior when CanHideSeries is enabled. Tests verify cursor-pointer class, checkbox toggling, and bar visibility updates on legend label clicks. Improves coverage for interactive legend features.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves the MudChart legend’s series-visibility UX by making the legend text label clickable (in addition to the checkbox) and adds unit tests to validate the behavior, addressing #13517.
Changes:
- Added an
@onclickhandler and pointer cursor styling to the legend label so clicking the text toggles series visibility. - Added unit tests to assert the label is clickable and that clicking it hides/shows the series.
Verification
- Commands run: none (review-only).
- Formatting run: no.
- Skipped verification: tests/build not executed in this review context.
Follow-up intentionally left out of scope
- None.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/MudBlazor/Components/Chart/Parts/Legend.razor | Makes the legend series label clickable and shows pointer cursor when series can be hidden. |
| src/MudBlazor.UnitTests/Components/Charts/BarChartTests.cs | Adds tests to validate label click toggles the checkbox and affects rendered bars. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Anu6is
approved these changes
Jul 27, 2026
Member
|
Thank you! |
This was referenced Aug 5, 2026
This was referenced Aug 10, 2026
Merged
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
LabelClick.mp4
Fixes #13517