-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
[charts-pro] Hide toolbar by default when exporting #18764
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-pro] Hide toolbar by default when exporting #18764
Conversation
Deploy preview: https://deploy-preview-18764--material-ui-x.netlify.app/ Updated pages: Bundle size reportTotal Size Change: 🔺+1.94KB(+0.01%) - Total Gzip Change: 🔺+818B(+0.02%) Show details for 100 more bundles (22 more not shown)@mui/x-charts-pro/ChartContainerPro parsed: 🔺+600B(+0.33%) gzip: 🔺+259B(+0.45%) |
CodSpeed Performance ReportMerging #18764 will improve performances by 8.56%Comparing Summary
Benchmarks breakdown
|
42e3def
to
c54489f
Compare
{ "name": "DefaultizedLineSeriesType", "kind": "Interface" }, | ||
{ "name": "DefaultizedPieSeriesType", "kind": "Interface" }, | ||
{ "name": "DefaultizedPieValueType", "kind": "TypeAlias" }, | ||
{ "name": "DefaultizedRadarSeriesType", "kind": "Interface" }, | ||
{ "name": "DefaultizedScatterSeriesType", "kind": "Interface" }, | ||
{ "name": "DefaultizedSeriesType", "kind": "TypeAlias" }, | ||
{ "name": "defaultOnBeforeExport", "kind": "Function" }, |
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 was a bit unsure whether to export this or not 🤔
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.
Exporting it looks good. Should it be renamed onBerforeExportRemoveToolbar
or something more explicit, I don't know
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 didn't want to name it after exactly what the function does because that might change in the future. For example, we might want it to hide more stuff (e.g., the zoom preview?).
But maybe we should call it onBeforeExportDefaultFn
or something similar?
|
||
// Pro components | ||
export * from './context'; | ||
export * from './hooks'; | ||
export * from './models'; |
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.
We weren't exporting the heatmap types from the main index. We are now.
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
1774c3d
to
93e974a
Compare
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.
Looks good. Should we also update the composition example in the next section to demonstrate how include a title and caption to show that it's feasible?
{ "name": "DefaultizedLineSeriesType", "kind": "Interface" }, | ||
{ "name": "DefaultizedPieSeriesType", "kind": "Interface" }, | ||
{ "name": "DefaultizedPieValueType", "kind": "TypeAlias" }, | ||
{ "name": "DefaultizedRadarSeriesType", "kind": "Interface" }, | ||
{ "name": "DefaultizedScatterSeriesType", "kind": "Interface" }, | ||
{ "name": "DefaultizedSeriesType", "kind": "TypeAlias" }, | ||
{ "name": "defaultOnBeforeExport", "kind": "Function" }, |
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.
Exporting it looks good. Should it be renamed onBerforeExportRemoveToolbar
or something more explicit, I don't know
I tried it and it isn't 100% feasible yet because the image export uses the chart's size to define the canvas size, causing the caption to be cut off. I'll merge this PR and open another one where users will be able to customize the exported width, height and device pixel ratio. |
Fixes #18758.
We'll now have a default
onBeforeExport
, which is exported asdefaultOnBeforeExport
.This should allow users to customize the behavior of
onBeforeExport
while keeping our defaults (if they want to).Screen.Recording.2025-07-10.at.16.39.08.mov