-
-
Notifications
You must be signed in to change notification settings - Fork 317
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
Chart component #2081
Chart component #2081
Conversation
import { usePageEditorState } from '../AppEditor/PageEditor/PageEditorProvider'; | ||
import { useDom, useDomApi } from '../AppState'; | ||
// eslint-disable-next-line import/no-cycle | ||
import BindableEditor from '../AppEditor/PageEditor/BindableEditor'; |
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 wonder whether we can solve all these cycles by creating a react context very high up in the toolpad app that holds a registry of all available propertyControls. It would still be a cyclic dependency, but one that we explicitly enabled through react API.
I'm ok with a sporadic // eslint-disable-next-line import/no-cycle
, but it's clear that this is going to become very infectious. Feels a bit like a code smell to me.
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.
Yeah it's becoming a bigger issue when we add controls with bindable props, I was focused on functionality first but will see if I can find a way to fix this.
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.
If it's too much we can do it in follow up, but I believe a context should be able to solve this in a quite straightforward way
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.
Turns out the cyclical dependency with prop controls was simpler than the other one with the binding editors - so passing the prop controls as context does fix the issue, nice one! I had thought it was part of the same problem.
I put the list of prop controls to pass to the context in the ComponentEditor
component - let me know if you think this should be done differently in terms of file structure.
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.
looking good
New chart component. Allows for composing line chart, bar chart, area chart and scatter chart, with independent data definitions for each chart.
Uses
recharts
, can gradually be moved to the new MUI X charts library, let's create an issue for that once this is merged.Closes #789
Related discussion: #2005
Screen.Recording.2023-07-12.at.23.31.21.mov