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

Hide overlapping x-axis tick labels #32829

Merged

Conversation

krkshitij
Copy link
Contributor

@krkshitij krkshitij commented Sep 13, 2024

Previous Behavior

The default number of x-axis ticks causes tick labels to overlap in smaller viewports.

New Behavior

When the hideTickOverlap prop is set to true, continuous axes (such as number and date) automatically adjust their tick count based on the container width, while categorical/string axes hide any tick labels that might overlap.

return convertToLocaleString(dataset[index], culture) as string;
});
.tickValues(tickValues)
.tickFormat(tickFormat);
Copy link
Contributor

Choose a reason for hiding this comment

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

ToDo: add unit tests for this logic

Copy link
Contributor Author

@krkshitij krkshitij Sep 14, 2024

Choose a reason for hiding this comment

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

Yes, will add the unit tests once the logic is finalized. Still have to cover scenarios like rotation, wrapping and truncation of tick labels. Also noticed that the calculateLongestLabelWidth util does not give very accurate results.

@krkshitij krkshitij marked this pull request as ready for review September 14, 2024 07:17
@krkshitij krkshitij requested a review from a team as a code owner September 14, 2024 07:17
@AtishayMsft
Copy link
Contributor

Could you resolve the conflict of change in prop name in upstream branch

@AtishayMsft
Copy link
Contributor

There is another conflict being reported. Could you resolve it.

@AtishayMsft AtishayMsft merged commit 8c0a4ac into microsoft:usr/atisjai/chartsV9 Oct 7, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants