Skip to content

MudChart: Allow clicking legend label to toggle series visibility - #13522

Merged
danielchalmers merged 5 commits into
MudBlazor:devfrom
Welchen:bugfix/ChartLegend
Jul 27, 2026
Merged

MudChart: Allow clicking legend label to toggle series visibility#13522
danielchalmers merged 5 commits into
MudBlazor:devfrom
Welchen:bugfix/ChartLegend

Conversation

@Welchen

@Welchen Welchen commented Jul 23, 2026

Copy link
Copy Markdown
Contributor
  • Allows the label for a chart series to be clickable along with the checkbox.
  • Displays the correct pointer for the label.
  • Tests to validate the label is also clickable.
LabelClick.mp4

Fixes #13517

Ryan Watson 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.
@mudbot mudbot Bot added the enhancement Adds a new feature or enhances existing functionality (not fixing a defect) in the main library label Jul 23, 2026
@mudbot mudbot Bot changed the title MudChart: Clickable label for chart series when it can be hidden. MudChart: Allow clicking legend label to toggle series visibility Jul 23, 2026
@danielchalmers
danielchalmers requested a review from Anu6is July 23, 2026 13:36
@versile2
versile2 requested a review from Copilot July 23, 2026 14:00

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 @onclick handler 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.

Comment thread src/MudBlazor/Components/Chart/Parts/Legend.razor Outdated
@danielchalmers

Copy link
Copy Markdown
Member

Thank you!

This was referenced Aug 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

accessibility Accessibility concerns (ARIA, keyboard, focus, screen readers, contrast) enhancement Adds a new feature or enhances existing functionality (not fixing a defect) in the main library

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MudChart: CheckBox label is not clickable

4 participants