include_once "loadfonts.php"; $pdf->AliasNbPages(); // first page - the pie chart $pdf->AddPage(); // pick some colors: grey for unknown, then step from green to red to indicate increasing age $colors[0] = array(175, 175, 175); $colors[1] = array(0, 255, 0); $colors[2] = array(204, 255, 102); $colors[3] = array(255, 255, 100); $colors[4] = array(255, 204, 102); $colors[5] = array(204, 102, 0); $colors[6] = array(255, 0, 0); $colors[7] = array(0, 0, 255); $pdf->SetFont($config->ParameterArray['PDFfont'], 'B', 16); $pdf->Cell(0, 18, __("Device Ages by Count"), '', 1, 'C', 0); $pdf->SetXY(10, 70); $pdf->PieChart(200, 80, $agingList, '%l : %v devices (%p)', $colors); // // cycle through years 1-3 and produce table reports // for ($year = 1; $year <= 5; $year++) { $start_year = $year - 1; $pdf->AddPage(); $pdf->SetFillColor(224, 235, 255); $pdf->SetFont($config->ParameterArray['PDFfont'], 'B', 16); $pdf->Cell(0, 15, __("Devices between {$start_year} and {$year} years old"), '', 1, 'C', 0); $pdf->SetFont($config->ParameterArray['PDFfont'], '', 10); $headerTags = array(__("Label"), __("Age"), __("Owner"), __("Primary Contact")); $cellWidths = array(45, 30, 50, 45); $maxval = count($headerTags); for ($col = 0; $col < $maxval; $col++) {
$pdf->SetFont('Arial', 'BIU', 12); $pdf->Cell(0, 5, '1 - Pie chart', 0, 1); $pdf->Ln(8); $pdf->SetFont('Arial', '', 10); $valX = $pdf->GetX(); $valY = $pdf->GetY(); $pdf->Cell(30, 5, 'Number of men:'); $pdf->Cell(15, 5, $data['Men'], 0, 0, 'R'); $pdf->Ln(); $pdf->Cell(30, 5, 'Number of women:'); $pdf->Cell(15, 5, $data['Women'], 0, 0, 'R'); $pdf->Ln(); $pdf->Cell(30, 5, 'Number of children:'); $pdf->Cell(15, 5, $data['Children'], 0, 0, 'R'); $pdf->Ln(); $pdf->Ln(8); $pdf->SetXY(90, $valY); $col1 = array(100, 100, 255); $col2 = array(255, 100, 100); $col3 = array(255, 255, 100); $pdf->PieChart(100, 35, $data, '%l (%p)', array($col1, $col2, $col3)); $pdf->SetXY($valX, $valY + 40); //Bar diagram $pdf->SetFont('Arial', 'BIU', 12); $pdf->Cell(0, 5, '2 - Bar diagram', 0, 1); $pdf->Ln(8); $valX = $pdf->GetX(); $valY = $pdf->GetY(); $pdf->BarDiagram(190, 70, $data, '%l : %v (%p)', array(255, 175, 100)); $pdf->SetXY($valX, $valY + 80); $pdf->Output();