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

[question] MUI X Bar chart: is it possible to rotate/hide xAxis labels? #10463

Closed
2 tasks done
St1ko opened this issue Sep 25, 2023 · 3 comments
Closed
2 tasks done

[question] MUI X Bar chart: is it possible to rotate/hide xAxis labels? #10463

St1ko opened this issue Sep 25, 2023 · 3 comments
Labels
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 support: commercial Support request from paid users support: question Community support but can be turned into an improvement

Comments

@St1ko
Copy link

St1ko commented Sep 25, 2023

Order ID or Support key 💳 (optional)

67005

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

The problem in depth 🔍

I want to display bar charts with a lot of records, the xAxis labels will start to overlap quite quickly. Is there a way to rotate the labels or hide every x-th label, so that the labels do not overlap?

Your environment 🌎

`npx @mui/envinfo`
  Don't forget to mention which browser you used.
  Output from `npx @mui/envinfo` goes here.
@St1ko St1ko added status: waiting for maintainer These issues haven't been looked at yet by a maintainer support: commercial Support request from paid users labels Sep 25, 2023
@zannager zannager added support: question Community support but can be turned into an improvement component: charts This is the name of the generic UI component, not the React module! labels Sep 25, 2023
@yaredtsy
Copy link
Contributor

hey @St1ko

Yes, you can. You can add your own style by using the class name selector.

    [`.${axisClasses.bottom} .${axisClasses.tickLabel}`]: {
      transform: 'rotateZ(-45deg)',
    },

demo: https://codesandbox.io/s/distracted-bartik-5nf433?file=/Demo.tsx

@alexfauquette
Copy link
Member

As explained by @yaredtsy you can use CSS to manipulate the label. For hiding some tick labels, it is not yet feasible. The feature is in the backlog

@St1ko
Copy link
Author

St1ko commented Sep 27, 2023

Thanks @yaredtsy and @alexfauquette

@St1ko St1ko closed this as completed Sep 27, 2023
@alexfauquette alexfauquette added enhancement This is not a bug, nor a new feature and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Sep 27, 2023
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! enhancement This is not a bug, nor a new feature support: commercial Support request from paid users support: question Community support but can be turned into an improvement
Projects
None yet
Development

No branches or pull requests

4 participants