-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Conversation
Deploy preview: https://deploy-preview-14191--material-ui-x.netlify.app/ |
@@ -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)) { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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(...)
There was a problem hiding this comment.
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 🤣
I extracted from #14121 your modification that solves #13973 and simplify extremum getters