Skip to content

MudChart: Support custom ToString func for Y axis#11674

Merged
ScarletKuro merged 14 commits intoMudBlazor:devfrom
IchBinAb4los:feature/chart-cultureinfo-support
Aug 18, 2025
Merged

MudChart: Support custom ToString func for Y axis#11674
ScarletKuro merged 14 commits intoMudBlazor:devfrom
IchBinAb4los:feature/chart-cultureinfo-support

Conversation

@IchBinAb4los
Copy link
Contributor

@IchBinAb4los IchBinAb4los commented Jul 17, 2025

Fixes #11673

Description

This PR adds support for formatting the Y axis values in MudChart using a custom ToString parameter.

Before:
image

With es-AR culture and 'tCO2e':
image

Tested locally in MudBlazor.Docs.Server

⚠️ Note: 3 unrelated test failures were observed in the solution during local test execution. They are not impacted by this change, which only adds a new formatting parameter to MudChart.

@github-actions github-actions bot added enhancement Adds a new feature or enhances existing functionality (not fixing a defect) in the main library localization Translations, locale formats, RTL layout, calendars labels Jul 17, 2025
@codecov
Copy link

codecov bot commented Jul 17, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.33%. Comparing base (35696c2) to head (2803644).
⚠️ Report is 137 commits behind head on dev.

Additional details and impacted files
@@            Coverage Diff             @@
##              dev   #11674      +/-   ##
==========================================
- Coverage   91.35%   91.33%   -0.02%     
==========================================
  Files         466      468       +2     
  Lines       14697    14766      +69     
  Branches     2853     2874      +21     
==========================================
+ Hits        13426    13487      +61     
- Misses        632      636       +4     
- Partials      639      643       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Anu6is
Copy link
Contributor

Anu6is commented Jul 17, 2025

While I could agree with the axis value being culture sensitive, I don't believe changing the ToS method to utilize culture is valid. It's used in multiple places, some of which may error if a comma is used for decimal values.

@IchBinAb4los
Copy link
Contributor Author

While I could agree with the axis value being culture sensitive, I don't believe changing the ToS method to utilize culture is valid. It's used in multiple places, some of which may error if a comma is used for decimal values.

Agreed. I will improve the implementation. Thank you for the feedback.

@IchBinAb4los IchBinAb4los changed the title MudChart - allowing Culture for Y axis strings MudChart - bar - Y axis: support custom ToString func Jul 17, 2025
@IchBinAb4los IchBinAb4los changed the title MudChart - bar - Y axis: support custom ToString func MudChart - Y axis: support custom ToString func Jul 18, 2025
@IchBinAb4los
Copy link
Contributor Author

Implemented for other charts too:
image
image
image

@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
13.6% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

@IchBinAb4los
Copy link
Contributor Author

Can anybody please help me? The code analysis is pointing a code duplication but I don't think it is right.

@github-actions github-actions bot added the awaiting triage Needs maintainer review or assistance label Aug 3, 2025
@github-actions github-actions bot changed the title MudChart - Y axis: support custom ToString func MudChart: Support custom ToString func for Y axis Aug 3, 2025
Copy link
Member

@ScarletKuro ScarletKuro left a comment

Choose a reason for hiding this comment

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

Change the indent back, rest looks good. Sorry for the long review.

Copy link
Member

@danielchalmers danielchalmers left a comment

Choose a reason for hiding this comment

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

Not sure why the quality bot still doesn't like it, but I fixed the indent and build errors in your branch. If you could add tests for YAxisToStringFunc we should be good to merge 👍

@danielchalmers danielchalmers removed the awaiting triage Needs maintainer review or assistance label Aug 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Adds a new feature or enhances existing functionality (not fixing a defect) in the main library localization Translations, locale formats, RTL layout, calendars regression Previously worked and now doesn't

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MudChart - Y axis string should support custom ToString func

4 participants