1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
| <?php
session_start();
include("fpdf.php");
include ("jpgraph/src/jpgraph.php");
include ("jpgraph/src/jpgraph_pie.php");
include("connexion.php");
@$red=ociparse($connect,"select count(code_in) as nbr,d.nom from incident i join departement d on d.code_d=i.code_d group by d.nom");
oci_execute($red,OCI_DEFAULT);
while(ocifetch($red)){
$data[]=ociresult($red,1);
$labels[]=ociresult($red,2)."\n(%.1f%%)";
}
$graph = new PieGraph(600,400);
$graph->SetShadow();
$graph->title->Set('Taux d Incident par Département');
$graph->title->SetFont(FF_VERDANA,FS_BOLD,20);
$graph->title->SetColor('black');
$p1 = new PiePlot($data);
$p1->SetCenter(0.5,0.5);
$p1->SetSize(0.3);
$p1->SetLabels($labels);
$p1->SetLabelPos(1);
$p1->SetLabelType(PIE_VALUE_PER);
$p1->value->Show();
$p1->value->SetFont(FF_ARIAL,FS_NORMAL,9);
$p1->value->SetColor('darkgray');
$graph->Add($p1);
$fichier = $graph->Stroke(_IMG_HANDLER);
$pdf=new FPDF();
$pdf->AddPage();
$pdf->setFont('Times','B',14);
$pdf->SetFillColor(230,230,230);
$pdf->cell(40,8,"Client: ");
$pdf->SetTextColor(198,79,0);
$pdf->cell(50,8,"Youssef S.");
$pdf->ln();
$pdf->Image($fichier);
$pdf->output("document.pdf");
$pdf->output();
?> |
Partager