Skip to content

[charts] Fix axis types not narrowing #17321

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

Merged
merged 15 commits into from
Apr 14, 2025

Conversation

bernardobelchior
Copy link
Member

@bernardobelchior bernardobelchior commented Apr 11, 2025

Fixes #10334.

Fixes axis type not narrowing when given a scaleType. Fix suggested by @alexfauquette here.

Copy link

github-actions bot commented Apr 11, 2025

Thanks for adding a type label to the PR! 👍

@bernardobelchior bernardobelchior added bug 🐛 Something doesn't work component: charts This is the name of the generic UI component, not the React module! labels Apr 11, 2025
@bernardobelchior bernardobelchior marked this pull request as ready for review April 11, 2025 08:11
@mui-bot
Copy link

mui-bot commented Apr 11, 2025

Deploy preview: https://deploy-preview-17321--material-ui-x.netlify.app/

Generated by 🚫 dangerJS against c34d46e

@bernardobelchior bernardobelchior marked this pull request as draft April 11, 2025 09:51
Copy link

codspeed-hq bot commented Apr 11, 2025

CodSpeed Performance Report

Merging #17321 will not alter performance

Comparing bernardobelchior:improve-axis-types (c34d46e) with master (24af71e)

Summary

✅ 8 untouched benchmarks

@@ -56,7 +55,7 @@ function getCategoryAxisConfig(
id: direction === 'x' ? DEFAULT_X_AXIS_KEY : DEFAULT_Y_AXIS_KEY,
...categoryAxis,
...(categoryAxis?.size ? { [isHorizontal ? 'height' : 'width']: categoryAxis.size } : {}),
position: categoryAxis?.position ?? (categoryAxis?.categories ? side : 'none'),
position: (categoryAxis?.position ?? (categoryAxis?.categories ? side : 'none')) as any,
Copy link
Member Author

Choose a reason for hiding this comment

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

This fixes a type error. I'm not sure how I could fix it otherwise. The cause seems to be that TS doesn't know which positions are valid depending on isHorizontal.

Copy link
Member

Choose a reason for hiding this comment

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

I pushed a fix. The issues seems to the categorical axis type that was not distributing the union.

@bernardobelchior bernardobelchior requested review from alexfauquette and JCQuintas and removed request for alexfauquette April 14, 2025 07:49
@bernardobelchior bernardobelchior marked this pull request as ready for review April 14, 2025 07:49
Copy link
Member

@alexfauquette alexfauquette left a comment

Choose a reason for hiding this comment

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

👍

@bernardobelchior bernardobelchior merged commit ea9382c into mui:master Apr 14, 2025
22 checks passed
@bernardobelchior bernardobelchior deleted the improve-axis-types branch April 14, 2025 11:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work component: charts This is the name of the generic UI component, not the React module!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[charts] Typescript error on band axis gap parameters
3 participants