Skip to content

[charts][docs] Improve Charts export docs #17538

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

Merged
merged 3 commits into from
Apr 28, 2025

Conversation

oliviertassinari
Copy link
Member

@oliviertassinari oliviertassinari commented Apr 24, 2025

I noticed this from #17353 - https://deploy-preview-17353--material-ui-x.netlify.app/x/react-charts/export/.

I almost didn't see that the demos on the page were interactive (I couldn't see the call to action buttons).

Preview: https://deploy-preview-17538--material-ui-x.netlify.app/x/react-charts/export/

@oliviertassinari oliviertassinari added docs Improvements or additions to the documentation component: charts This is the name of the generic UI component, not the React module! labels Apr 24, 2025
@@ -63,6 +63,6 @@ As detailed in the [Composition](/x/react-charts/composition/) section, charts c
When exporting a chart, the `ChartsWrapper` element is considered the root element of the chart, and every descendant is included in the export.
As such, you need to ensure that the `ChartsWrapper` element is the root element of the chart you want to export.

If you want to use a custom wrapper element, you need to use the `useChartRootRef` hook to set the reference to the chart's root element so that exporting works properly, as exemplified below.
If you want to use a custom wrapper element, you need to use the `useChartRootRef()` hook to set the reference to the chart's root element so that exporting works properly, as exemplified below.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

function should be (), see style guide.


## Export as image

The `apiRef` prop also exposes a `exportAsImage()` method to export the chart as an image.

### Dependency

For `exportAsImage()` to work, you need to add `rasterizehtml` as a dependency in your project.
For `exportAsImage()` to work, you need to add the`rasterizehtml` npm dependency in your project.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a bit clearer for people that wonder what a dependency is.

@mui-bot
Copy link

mui-bot commented Apr 24, 2025

Deploy preview: https://deploy-preview-17538--material-ui-x.netlify.app/

Updated pages:

Generated by 🚫 dangerJS against 098fba2

Copy link

codspeed-hq bot commented Apr 25, 2025

CodSpeed Performance Report

Merging #17538 will not alter performance

Comparing oliviertassinari:fix-typos (098fba2) with master (cb6ae55)

Summary

✅ 8 untouched benchmarks

@oliviertassinari oliviertassinari merged commit 37cd426 into mui:master Apr 28, 2025
22 checks passed
@oliviertassinari oliviertassinari deleted the fix-typos branch April 28, 2025 11:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: charts This is the name of the generic UI component, not the React module! docs Improvements or additions to the documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants