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] Support axis with single value #14191

Merged
merged 5 commits into from
Aug 14, 2024

Conversation

alexfauquette
Copy link
Member

@alexfauquette alexfauquette commented Aug 13, 2024

I extracted from #14121 your modification that solves #13973 and simplify extremum getters

@mui-bot
Copy link

mui-bot commented Aug 13, 2024

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

Generated by 🚫 dangerJS against 0e1652b

packages/x-charts/src/ChartsXAxis/ChartsXAxis.tsx Outdated Show resolved Hide resolved
@@ -145,7 +145,7 @@ export function useTicks(
}));
}

if (scale.domain().length === 0 || scale.domain()[0] === scale.domain()[1]) {
if (scale.domain().length === 0 || !scale.domain().every(Number.isFinite)) {
Copy link
Member Author

Choose a reason for hiding this comment

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

Here you removed the second condition. I keep the check on infinite to avoid plotting the grid if the axis has an inifinit domain. For example the y-axis of a line chart without data

Copy link
Member

Choose a reason for hiding this comment

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

IIRC this will cause issues when axis is band/point

Copy link
Member Author

Choose a reason for hiding this comment

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

Looks like it's time that causes issue. Because the Number.isFinite() returns false for dates. So the code was doing a confusion between Infinity and Date(...)

Copy link
Member

Choose a reason for hiding this comment

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

Gotta push that new isInfinity function though 🤣

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!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants