Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[charts] Remove labelFontSize and tickFontSize props #15633

Merged
merged 9 commits into from
Nov 28, 2024

Conversation

JCQuintas
Copy link
Member

@JCQuintas JCQuintas commented Nov 27, 2024

Props were deprecated, removing them.

Part of #13820

Changelog

  • Remove labelFontSize and tickFontSize props. They were previously deprecated and have now been removed — Learn more

@JCQuintas JCQuintas added breaking change enhancement This is not a bug, nor a new feature component: charts This is the name of the generic UI component, not the React module! v8.x labels Nov 27, 2024
@JCQuintas JCQuintas self-assigned this Nov 27, 2024
@mui-bot
Copy link

mui-bot commented Nov 27, 2024

Copy link

codspeed-hq bot commented Nov 27, 2024

CodSpeed Performance Report

Merging #15633 will degrade performances by 24.1%

Comparing JCQuintas:remove-labelFontSize (1ab3079) with master (1992f8d)

Summary

❌ 1 regressions
✅ 5 untouched benchmarks

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Benchmarks breakdown

Benchmark master JCQuintas:remove-labelFontSize Change
ScatterChartPro with big data amount 126.4 ms 166.5 ms -24.1%

@JCQuintas JCQuintas marked this pull request as ready for review November 27, 2024 17:19
@JCQuintas JCQuintas mentioned this pull request Nov 27, 2024
6 tasks
@@ -104,6 +100,8 @@ function ChartsYAxis(inProps: ChartsYAxisProps) {

const positionSign = position === 'right' ? 1 : -1;

const tickFontSize = 12;
Copy link
Member

Choose a reason for hiding this comment

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

What about keeping the default behavior if user provides a number?

Suggested change
const tickFontSize = 12;
const tickFontSize = typeof tickLabelStyle.fontSize ==== 'number' ? tickLabelStyle.fontSize : 12;

Or make it a constant outside of the component named defaultTickFontSize because otherwise it looks like it's the actual one whereas the user could modify it

Copy link
Member Author

Choose a reason for hiding this comment

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

Nice catch, I've added your suggestion, but we could also parse strings if necessary with something like

function parseTickFontSize(fontSize: string | number) {
if (typeof fontSize === 'number') return fontSize
if (fontSize.includes('px') || /^[0-9]*$/.test('fontSize')) return parseInt(fontSize)
return 12

Copy link
Member Author

Choose a reason for hiding this comment

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

Argos changed because we were never taking tickLabelStyle.fontSize into account in the calc 😅

@alexfauquette
Copy link
Member

Very clean code mode 👍

@alexfauquette
Copy link
Member

The PR close the deprecation issue. At le ast I don't see other deprecated elements :)

@JCQuintas JCQuintas merged commit 00af025 into mui:master Nov 28, 2024
18 of 19 checks passed
@JCQuintas JCQuintas deleted the remove-labelFontSize branch November 28, 2024 15:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change component: charts This is the name of the generic UI component, not the React module! enhancement This is not a bug, nor a new feature v8.x
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants