Fakultas Ilmu Komputer UI

Commit ecc0c6c8 authored by Nabilah Adani's avatar Nabilah Adani
Browse files

Merge branch 'nabh/diagram-statistik-kasus-fe' into 'pbi-13-diagram-statistik-kasus'

tampilan pie di pdf

See merge request !56
parents 2cdccbd0 0a0e81af
Pipeline #82089 passed with stages
in 10 minutes and 9 seconds
......@@ -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;
......@@ -137,6 +141,9 @@ const image2pdf = (imageType: string, type: string, key: string, dataType: stri
doc.setFont("arial", "bold");
if (key === "Tanggal")
doc.text("DATA KASUS TBC DEPOK", pageWidth/2, 24, {align:"center"});
else
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"});
}
......@@ -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"})
}
......@@ -260,6 +267,9 @@ const image2pdf = (imageType: string, type: string, key: string, dataType: stri
let png = canvas.toDataURL('image/png', 1.0);
if (key === "Tanggal")
doc.addImage(png, imageType, marginX, 12, 252, 156, undefined, "SLOW");
else
if (chartType)
doc.addImage(png, imageType, pageImgWidth, pageImgHeight, imgPieWidth, imgPieHeight, undefined, "SLOW");
else
doc.addImage(png, imageType, marginX, 12, imgWidth, imgHeight, undefined, "SLOW");
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment