-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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] Accept component in labelMarkType
#16739
[charts] Accept component in labelMarkType
#16739
Conversation
export interface ChartsLabelCustomMarkProps { | ||
className?: string; | ||
/** Color of the series this mark refers to. */ | ||
color?: string; | ||
} |
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 if we should pass the seriesId
here. Otherwise if someone is using the same component for all series they won't know which series is rendering the current component.
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.
Could be an option yeah
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.
@alexfauquette what's your take?
If the decision is affirmative, I'll do that in a follow-up PR so I can merge this PR faster.
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 don't see a reason to modify the component based on the id. The series type already make more sense.
I fear that with passing ids, people start do do complex stuff relying on ids, and then realise small id change can break their entire legend design
width: 14, | ||
height: 14, |
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.
Had to define a default size here so that the custom component defaults to occupying 100% of the width/height.
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.
You would need to set the height on labelMarkClasses.line
as unset
. It added a few pixels to the demos, hence all the changes 🫠
Deploy preview: https://deploy-preview-16739--material-ui-x.netlify.app/ Updated pages: |
985673a
to
6e1c6ff
Compare
6e1c6ff
to
fbbda0f
Compare
Co-authored-by: Jose C Quintas Jr <[email protected]> Signed-off-by: Bernardo Belchior <[email protected]>
Related to #16640. Implementation of option B as defined here.
Accept component in
labelMarkType
to customize the mark in legends and tooltips.A consequence of this API is that when customizing the shape of a scatter chart, a user will need to define the
labelMarkType
and scatter shape in different places.Screen.Recording.2025-02-26.at.10.53.58.mov