Skip to content

Commit

Permalink
fixes for report pdf export
Browse files Browse the repository at this point in the history
  • Loading branch information
VineetBala-AOT committed Jul 17, 2023
1 parent e62ec5a commit 98555cc
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 11 deletions.
2 changes: 1 addition & 1 deletion met-web/src/components/publicDashboard/Dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ const Dashboard = () => {
</Grid>
</Grid>
</When>
<Grid item sm={4}>
<Grid id={'kpi-emails-sent'} item sm={4}>
<SurveyEmailsSent
engagement={engagement}
engagementIsLoading={isEngagementLoading}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,19 +75,28 @@ export const SurveyBarPrintable = ({ engagement, engagementIsLoading }: SurveyQu
<ResponsiveContainer width={'100%'} height={400} key={result.position}>
<BarChart
data={result.result}
layout="vertical"
layout={'vertical'}
key={result.position}
margin={{ left: { md: 20, lg: 0 } }}
margin={{ left: 0 }}
>
<XAxis hide axisLine={false} type="number" />
<XAxis
dataKey={undefined}
type={'number'}
axisLine={true}
tickLine={true}
minTickGap={10}
tickMargin={10}
hide={true}
/>
<YAxis
width={250}
dataKey="value"
type="category"
dataKey={'value'}
type={'category'}
axisLine={true}
tickLine={true}
minTickGap={10}
tickMargin={10}
hide={false}
/>
<Tooltip />
<Bar
Expand All @@ -99,7 +108,7 @@ export const SurveyBarPrintable = ({ engagement, engagementIsLoading }: SurveyQu
>
<LabelList
dataKey="count"
position="insideRight"
position={'insideRight'}
style={{ fill: 'white' }}
/>
</Bar>
Expand Down
8 changes: 4 additions & 4 deletions met-web/src/components/publicDashboard/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,23 +64,23 @@ export const generateDashboardPdf = async (
const emailsSent = document.getElementById('kpi-emails-sent');
if (emailsSent) {
const emailsSentData = await toPng(emailsSent);
addImageToPdf(doc, emailsSentData, padding, top, 75, 75);
addImageToPdf(doc, emailsSentData, padding + 15, top, 70, 70);
}
handlePdfExportProgress(20);

const surveysCompleted = document.getElementById('kpi-surveys-completed');
if (surveysCompleted) {
const surveysCompletedData = await toPng(surveysCompleted);
addImageToPdf(doc, surveysCompletedData, padding, top + 75, 75, 75);
addImageToPdf(doc, surveysCompletedData, padding + 95, top, 70, 70);
}
handlePdfExportProgress(40);

const mapImageDataURL = await getMapImageDataUrl(projectMapData);

doc.setFontSize(9);
doc.setFont('helvetica', 'bold');
doc.text('Project Map\n\n', 10, top + 155);
addImageToPdf(doc, mapImageDataURL, 10, top + 160, 75, 75);
doc.text('Project Map\n\n', padding + 55, top + 80);
addImageToPdf(doc, mapImageDataURL, padding + 55, top + 85, 75, 75);
doc.addPage();
handlePdfExportProgress(60);

Expand Down

0 comments on commit 98555cc

Please sign in to comment.