-
-
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] Pass all props to legend #14392
Conversation
Deploy preview: https://deploy-preview-14392--material-ui-x.netlify.app/ |
CodSpeed Performance ReportMerging #14392 will not alter performanceComparing Summary
|
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.
Look nice 👍
/** | ||
* Set to true to hide the legend. | ||
* @default false | ||
*/ | ||
hidden?: boolean; |
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.
Make me think that this hidden
and the early return null
associated would better fit in the parent components to do not compute item placement if the legend is hidden
import { DefaultizedProps } from '../models/helpers'; | ||
import { DefaultChartsLegend, LegendRendererProps } from './DefaultChartsLegend'; | ||
import { useDrawingArea } from '../hooks'; | ||
import { useSeries } from '../hooks/useSeries'; | ||
import { LegendPlacement } from './legend.types'; | ||
|
||
export type ChartsLegendPropsBase = Omit< | ||
LegendRendererProps, | ||
keyof LegendPlacement | 'series' | 'seriesToDisplay' | 'drawingArea' |
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.
Was this intended to make seriesToDisplay
an invalid key to BarChart.slotProps.legend
?
Edit: Looks like an issue is already open for this: #14561
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.
It was intentional for the ChartsLegendPropsBase
because those props are also used for color map legends
But not sure it was intentional for the slot to lose it @JCQuintas can you confirm?
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.
🤔 It wasn't intentional, but I expected our type generating scripts to pick it up 😓
As part of #14231 I've noticed some props weren't properly documented nor passed to the components.
Allowing these props should make small adjustments simpler for the user.
Also made prop inheritance a bit simpler
As opposed to previously where