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] Clean the axis rendering #8948

Merged
merged 10 commits into from May 16, 2023

Conversation

alexfauquette
Copy link
Member

@alexfauquette alexfauquette commented May 10, 2023

  • Use the nice() methods on continuouse scale. This method rounds the axis scale such that ticks fall on round numbers
  • Compute the number of ticks in advance to pas them to the nice() method (improve the computation)
  • Allows CSS customization on x axis
  • Allows CSS customization on y axis (wait for review on the X one)

@alexfauquette alexfauquette added the component: charts This is the name of the generic UI component, not the React module! label May 10, 2023
@mui-bot
Copy link

mui-bot commented May 10, 2023

Netlify deploy preview

Netlify deploy preview: https://deploy-preview-8948--material-ui-x.netlify.app/

Updated pages

No updates.

These are the results for the performance tests:

Test case Unit Min Max Median Mean σ
Filter 100k rows ms 820.9 1,236.1 1,236.1 1,036.8 165.572
Sort 100k rows ms 954.4 3,190 1,576.9 1,687.58 777.926
Select 100k rows ms 302.4 812.5 340.1 435.86 191.342
Deselect 100k rows ms 200.6 482.2 294.4 330.02 105.251

Generated by 🚫 dangerJS against 21cb03d

@github-actions
Copy link

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged label May 12, 2023
@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged label May 12, 2023
@alexfauquette
Copy link
Member Author

alexfauquette commented May 12, 2023

@flaviendelangle I think this PR solves your comment about letting some padding (Argos is useful to verify it).

It's not perfect, especially when charts data match round values. But most of the real-world data do not have their maximal at 1500 or 2000. It's more likely number such as 1378 or 2167 which let some space on top to ba able top place round ticks such as 1400 and 2200

@flaviendelangle
Copy link
Member

It's a good first step indeed 👍

packages/x-charts/src/BarChart/BarChart.tsx Show resolved Hide resolved
unstable_generateUtilityClasses as generateUtilityClasses,
} from '@mui/utils';

export interface XAxisClasses {
Copy link
Member

Choose a reason for hiding this comment

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

Would it make sense to have the same classes for the X and Y axes (to avoid duplication) and a class directionX / directionY to differentiate the two ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Nice ide, I update it such that roo get the direction and the position:

For example bottom x axis will get MuiAxis-root MuiAxis-directionX MuiAxis-bottom classes

Copy link
Member

Choose a reason for hiding this comment

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

Actually, I wonder if MuiAxis-directionX is needed, since we have MuiAxis-bottom

In which scenario would you need directionX ?

Copy link
Member Author

Choose a reason for hiding this comment

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

To get the same style on top and bottom without having to care about the position

For example you you show both axis, you could customize bottom and top ticks the same way, with directionX classe and remove only top ticks labels with top classe

Copy link
Member

@flaviendelangle flaviendelangle left a comment

Choose a reason for hiding this comment

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

Nice work 🥳

@alexfauquette alexfauquette merged commit 52330d2 into mui:master May 16, 2023
17 checks passed
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.

None yet

3 participants