Skip to content

[charts] Support axis with single value#14191

Merged
alexfauquette merged 5 commits intomui:masterfrom
alexfauquette:extract-infit-usage
Aug 14, 2024
Merged

[charts] Support axis with single value#14191
alexfauquette merged 5 commits intomui:masterfrom
alexfauquette:extract-infit-usage

Conversation

@alexfauquette
Copy link
Copy Markdown
Member

@alexfauquette alexfauquette commented Aug 13, 2024

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

@mui-bot
Copy link
Copy Markdown

mui-bot commented Aug 13, 2024

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

Generated by 🚫 dangerJS against 0e1652b

Comment thread packages/x-charts/src/ChartsXAxis/ChartsXAxis.tsx Outdated
Comment thread packages/x-charts/src/ScatterChart/extremums.ts
Comment thread packages/x-charts/src/hooks/useTicks.ts Outdated
}

if (scale.domain().length === 0 || scale.domain()[0] === scale.domain()[1]) {
if (scale.domain().length === 0 || !scale.domain().every(Number.isFinite)) {
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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 🤣

@alexfauquette alexfauquette merged commit 35f6025 into mui:master Aug 14, 2024
@alexfauquette alexfauquette deleted the extract-infit-usage branch August 14, 2024 07:40
@zannager zannager added the scope: charts Changes related to the charts. label Aug 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope: charts Changes related to the charts.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants