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] Allow tickLabelPlacement='middle' in continuous scales #16803

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

JCQuintas
Copy link
Member

👻

  • Allow tickLabelPlacement='middle' in continuous scales
  • Add example of overlapping axis
  • Exported AxisValueFormatterContext which wasn't previously exported

Screenshot 2025-03-03 at 18 05 52

Changelog

  • Charts axes now accept tickLabelPlacement='middle' on continuous scales as well as 'band' scale.

@JCQuintas JCQuintas added new feature New feature or request component: charts This is the name of the generic UI component, not the React module! labels Mar 3, 2025
@JCQuintas JCQuintas self-assigned this Mar 3, 2025
@mui-bot
Copy link

mui-bot commented Mar 3, 2025

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

Updated pages:

Generated by 🚫 dangerJS against f8b984a

Copy link

codspeed-hq bot commented Mar 3, 2025

CodSpeed Performance Report

Merging #16803 will not alter performance

Comparing JCQuintas:overlappingaxes (f8b984a) with master (03f0c05)

Summary

✅ 7 untouched benchmarks

@alexfauquette
Copy link
Member

I like the idea, but with the axis highlight it feels a bit weird. But the inspiration is weird too

image

Maybe we could get a better result with more data points:

  • The true axis (the one to line series use) with points every week
  • The first displayed axis with months
  • the second displayed with quaters

@JCQuintas
Copy link
Member Author

Tried using bar chart and band. But I'm unsure if the changes are sane. f8b984a

Looks good though

Screenshot 2025-03-04 at 11 54 28

@@ -218,6 +218,15 @@ To avoid overlapping, you can use the `height` prop for `xAxis` and `width` for

{{"demo": "MultipleAxes.js"}}

### Overlapping axes

In order to overlap axes, the axis size can be set to `0`.
Copy link
Member

@bernardobelchior bernardobelchior Mar 4, 2025

Choose a reason for hiding this comment

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

This feels a bit like a workaround. In this PR we're going to start taking the size into account and it will cause the labels to be hidden:

image

Should we consider a less hacky API? E.g., translating the second axis.

Copy link
Member Author

Choose a reason for hiding this comment

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

We can also just drop this if it is too much. Translating the axis will still make the axis count into the sizes though

Copy link
Member

Choose a reason for hiding this comment

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

I see some value in this example, so it might make sense to have it in the docs. However, we should probably use a custom component for it, or another workaround, since this one will break in the short term.

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! new feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants