From 0a0e81afbe55592c78188cf4941aa7ad68c4cd3e Mon Sep 17 00:00:00 2001 From: Nabilah Adani Date: Mon, 7 Jun 2021 14:26:20 +0700 Subject: [PATCH] [CHORES] edit pie img width and height --- src/scenes/Home/utilities/utils.tsx | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/scenes/Home/utilities/utils.tsx b/src/scenes/Home/utilities/utils.tsx index 8d4adf9..3eec9cf 100644 --- a/src/scenes/Home/utilities/utils.tsx +++ b/src/scenes/Home/utilities/utils.tsx @@ -121,6 +121,10 @@ const image2pdf = (imageType: string, type: string, key: string, dataType: stri const imgHeight = 130; const pageWidth = 297; const pageHeight = 210; + const imgPieWidth = 212; + const imgPieHeight = 110; + const pageImgWidth = 38; + const pageImgHeight = 30; const marginX = (pageWidth - imgWidth) / 2; @@ -138,7 +142,10 @@ const image2pdf = (imageType: string, type: string, key: string, dataType: stri if (key === "Tanggal") doc.text("DATA KASUS TBC DEPOK", pageWidth/2, 24, {align:"center"}); else - doc.text("DATA KASUS TBC DEPOK", pageWidth/2, 18, {align:"center"}); + if (chartType) + doc.text("DATA KASUS TBC DEPOK", pageWidth/2, 18, {align:"center"}); + else + doc.text("DATA KASUS TBC DEPOK", pageWidth/2, 18, {align:"center"}); } const writeInfoCases = (doc: jsPDF) => { @@ -204,7 +211,7 @@ const image2pdf = (imageType: string, type: string, key: string, dataType: stri doc.text("Total Keseluruhan : " + total + " Kasus" , pageWidth/2, 155, {align:"center"}) else if (chartType) - doc.text("Total Keseluruhan : " + total + " Kasus", pageWidth/2, 140, {align:"center"}) + doc.text("Total Keseluruhan : " + total + " Kasus", pageWidth/2, 150, {align:"center"}) else doc.text("Total Keseluruhan : " + total + " Kasus", pageWidth/2, 150, {align:"center"}) } @@ -261,7 +268,10 @@ const image2pdf = (imageType: string, type: string, key: string, dataType: stri if (key === "Tanggal") doc.addImage(png, imageType, marginX, 12, 252, 156, undefined, "SLOW"); else - doc.addImage(png, imageType, marginX, 12, imgWidth, imgHeight, undefined, "SLOW"); + if (chartType) + doc.addImage(png, imageType, pageImgWidth, pageImgHeight, imgPieWidth, imgPieHeight, undefined, "SLOW"); + else + doc.addImage(png, imageType, marginX, 12, imgWidth, imgHeight, undefined, "SLOW"); } const blobToImage = (blob: Blob) => { -- GitLab