Im using mui to draw charts in my frontend, specifically a barchart and a piechart and i would like to know how can i export them from the backend as pdfs, im currently using pdfmake but i cant really print out charts with it, so my question would be is there another library that i can use to export charts similar to the mui ones, or should i redo the charting in the frontend with another library
I tried adding a div to the charts so i’d get its id and try to work around it to make it a base64 image string and pass it to the pdfmake service function in my backend but that wouldnt work.
so lets say i want to export this for example :
<PieChart
series={[
{
data: [{ value: ticketpie.treated, label: t('dashboard.tickets.treated') },
{ value: ticketpie.nontreated, label:t('dashboard.tickets.nonTreated')}
],
innerRadius: 60,
highlightScope: { faded: 'global', highlighted: 'item' },
faded: { additionalRadius: -30, color: 'gray' },
},
]}
sx={{
[`& .${pieArcLabelClasses.root}`]: {
fill: 'white',
fontWeight: 'bold',
},
}}
height={250}
/>
what should i do ?
HamzaDev is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.