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] fix x-axis tick label overflow #16709

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

bernardobelchior
Copy link
Member

@bernardobelchior bernardobelchior commented Feb 24, 2025

Part of #10928.

To do

  • Test multi-line labels
  • Test multiple anchors/baselines

@mui-bot
Copy link

mui-bot commented Feb 24, 2025

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

Generated by 🚫 dangerJS against a1d7350

@bernardobelchior bernardobelchior added the component: charts This is the name of the generic UI component, not the React module! label Feb 24, 2025
@bernardobelchior bernardobelchior force-pushed the fix-axis-tick-label-overflow branch from 8e61dfe to 961878d Compare February 24, 2025 15:51
@bernardobelchior
Copy link
Member Author

It seems the tick labels are hidden in visual tests:

image

The reason is simple, but also unfortunate. We're spreading the style of MUI's caption onto the tick label, which has a line-height of 1.66. By default, the X axis has a height of 25px and the tick size is by default 6px. This means that there's 19px for the tick label to take up. The default font size of the tick label is 12px, which multiplied by 1.66 is 19.92px, meaning that it's 0.92px above the limit, so the label is hidden.

Options:

  1. Increase default axis height
  2. Decrease default tick size
  3. Decrease tick label line height

In my opinion, number 3 is best because a line height of 1.66 seems to big for this use case.

This is a line height of 1.25:
image

This is a default line height of 1.66:

image

Is a default line height of 1.25 acceptable?

@bernardobelchior bernardobelchior force-pushed the fix-axis-tick-label-overflow branch from 2b2dc4c to acd8b68 Compare February 25, 2025 08:36
@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged label Feb 28, 2025
Copy link

This pull request has conflicts, please resolve those before we can evaluate the pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: charts This is the name of the generic UI component, not the React module! PR: out-of-date The pull request has merge conflicts and can't be merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants