-
-
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] Add Gauge component #11996
[charts] Add Gauge component #11996
Conversation
Deploy preview: https://deploy-preview-11996--material-ui-x.netlify.app/ Updated pages: |
The issue is that the single component can not do all at once. I made it such that it should be easy to add/remove components. From the issue benchmark, other libraries are at 50/50 between having a pointers or not. The idea of this default gauge come from this issue (by the way @johnsonav1992 you might be interested in this new component) Assuming that if a user created it might interest others. I'm going to ask in the issue After there is the technical aspect. The pointer only make sens if we create a reference to point. So either displaying ticks, or arc colors. That's additional complex components I would prefer to share with other charts (for example supporting varying colors according to the value could also benefit to line and bar chart) to have it working well on all it's a non negligeable API thinking |
@alexfauquette This is great!! I was hoping for a default "donut" chart option like what you are building here (you are calling it a gauge but same thing) when I was building the donut for our app at my work, but I was able to do it with the pie charts after some tinkering around to get everything to look right (getting the color of the back arc of the donut to be different than the front was probably the hardest part). However, this will definitely reduce the overhead that people will need to deal with in terms of using the documentation to create such a donut chart. Appreciate all your hard work and innovation in this library! We are loving using it so far! |
// { | ||
// title: 'Gauge', | ||
// srcLight: '/static/x/component-illustrations/gauge-light.png', | ||
// srcDark: '/static/x/component-illustrations/gauge-dark.png', | ||
// href: '/x/react-charts/gauge/', | ||
// }, |
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.
I will remove comments when the image is available
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.
Added illustrations for that in a separate PR → #12041
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.
Quick copywriting improvements here and there!
- GaugeReferenceArc | ||
- GaugeValueArc | ||
- GaugeValueText |
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.
- GaugeReferenceArc | |
- GaugeValueArc | |
- GaugeValueText | |
- `<GaugeReferenceArc />` | |
- `<GaugeValueArc />` | |
- `<GaugeValueText />` |
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.
Great work! 👏
Very nice improvement to the charts portfolio. 👍
WDYT about adding this component to themeAugmentation
?
Do we want it?
Based on the styled
components it would seem that we expect the theme to be overridden, but it's not doable at the moment. 🤔
The Arcs configuration demo from the docs breaks if either the |
Co-authored-by: Danilo Leal <67129314+danilo-leal@users.noreply.github.com> Co-authored-by: Lukas <llukas.tyla@gmail.com> Signed-off-by: Alexandre Fauquette <45398769+alexfauquette@users.noreply.github.com>
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
I mostly use them to get access to the theme, to pick colors. And for root components to support |
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.
Great job! 👏 🚀
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.
Cool nice to see this land 👍 .
Ideas on things that developers might raise going forward:
- Animation
- Component behavior when the value goes outside of the [0, 100] range.
- Support areas (red, green, yellow) https://www.metabase.com/docs/latest/questions/sharing/visualizations/gauge
- A built-in GaugePointer component that can be composed with the Gauge?
- The docs says to use
value={null}
to not show the value, but it showsNaN
/** | ||
* The height of the chart in px. If not defined, it takes the height of the parent element. | ||
* @default undefined | ||
*/ | ||
height: PropTypes.number, |
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.
Comment moved to mui/material-ui#41139
It's done on purpose. I'm waiting for their feedback to prioritise
|
@alexfauquette I was almost going to use this for a finance use case (showing how much cash is in our EUR bank account, and triggering an error email if it's too low https://mui.metabaseapp.com/question/305-finance-qonto-insufficient-funds) but Metabase doesn't support this Gauge charts for email reports so I used another chart that is supported (linear gauge) 😅
Maybe Toolpad pro code API could have a default opinionated design which is fair enough for MUI X.
Maybe with But en empty string |
I suggest there be at least 1 built-in pointer (or maybe 2), making the DX as smooth as possible, and assuring the dev that Material Design principles are properly followed, unlike potential custom-made solutions. As an example, with a single customizable pointer, it would be possible to implement both a pointer that starts from the center of the circle, like the one currently illustrated in the docs, and a pointer that consists of a tiny indicator near the inner arc border itself, like this one: https://ft.syncfusion.com/featuretour/essential-js2/images/circular-gauge/javascript-circular-gauge-redndered-with-marker-pointer.jpg For more customization, developers would be able to create custom pointers just like suggested in the docs as of now. |
Signed-off-by: Alexandre Fauquette <45398769+alexfauquette@users.noreply.github.com> Co-authored-by: Danilo Leal <67129314+danilo-leal@users.noreply.github.com> Co-authored-by: Lukas <llukas.tyla@gmail.com>
Fix #2903
Tasks
<p>
displayed bellow or on top)Preview https://deploy-preview-11996--material-ui-x.netlify.app/x/react-charts/gauge/