foreach ($data as $l => $val) { $p = sprintf('%.2f', $val / $this->sum * 100) . '%'; $legend = str_replace(array('%l', '%v', '%p'), array($l, $val, $p), $format); $this->legends[] = $legend; $this->wLegend = max($this->GetStringWidth($legend), $this->wLegend); } } } $tenantList = $dev->GetTop10Tenants(); $powerList = $dev->GetTop10Power(); // // // Begin Report Generation // // $pdf = new PDF_Diag(); include_once "loadfonts.php"; $pdf->AliasNbPages(); $pdf->AddPage(); $pdf->SetFont($config->ParameterArray["PDFfont"], '', 8); $pdf->SetFillColor(0, 0, 0); $pdf->SetTextColor(255); $pdf->SetDrawColor(128, 0, 0); $pdf->SetLineWidth(0.3); $pdf->SetfillColor(224, 235, 255); $pdf->SetTextColor(0); $pdf->SetFont($config->ParameterArray["PDFfont"], "", 12); if (function_exists('money_format')) { $pdf->Cell(300, 5, __("Annual Cost Per Rack Unit (Year)") . ': ' . money_format("%.2n", $annualCostPerUYear), "", 1, "L", ""); $pdf->Cell(300, 5, __("Annual Cost Per Watt (Year)") . ': ' . money_format("%.4n", $annualCostPerWattYear), "", 1, "L", ""); } else {
} } // get a breakdown of device ages $agingList = $dev->GetAge(); // find devices older than five years $oldestlist = $dev->GetDeviceByAge(6); // iterate for years 0-1, 1-2, 2-3, 3-4, 4-5 for ($year = 1; $year <= 5; $year++) { $age_list[$year] = $dev->GetDeviceByAge($year); } // // // Begin Report Generation // // $pdf = new PDF_Diag(); 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);
<?php require 'diag.php'; $pdf = new PDF_Diag(); $pdf->AddPage(); $data = array('Men' => 1510, 'Women' => 1610, 'Children' => 1400); //Pie chart $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);
$this->wLegend = max($this->GetStringWidth($legend), $this->wLegend); } } } // yes, this needs major cleanup $warranty_expiration_list = $dev->GetWarrantyExpiration(); $expiredlist = $dev->GetDeviceByWarranty(-1); // iterate for years 0-1, 1-2, 2-3 for ($year = 1; $year <= 3; $year++) { $expire_list[$year] = $dev->GetDeviceByWarranty($year); } // // Begin Report Generation // // first page - the pie chart $pdf = new PDF_Diag(); include_once "loadfonts.php"; $pdf->AliasNbPages(); $pdf->AddPage(); // pick some colors: grey for unknown, deep red for expired, then step from red to green to indicate remaining warranty $colors[0] = array(175, 175, 175); $colors[1] = array(153, 51, 0); $colors[2] = array(255, 0, 0); $colors[3] = array(255, 204, 102); $colors[4] = array(255, 255, 100); $colors[5] = array(204, 255, 102); $colors[6] = array(0, 255, 0); $colors[7] = array(255, 0, 0); $pdf->SetFont($config->ParameterArray['PDFfont'], 'B', 16); $pdf->Cell(0, 18, __("Warranty Status"), '', 1, 'C', 0); $pdf->SetXY(10, 70);
foreach ($data as $l => $val) { $p = sprintf('%.2f', $val / $this->sum * 100) . '%'; $legend = str_replace(array('%l', '%v', '%p'), array($l, $val, $p), $format); $this->legends[] = $legend; $this->wLegend = max($this->GetStringWidth($legend), $this->wLegend); } } } $tenantList = $dev->GetTop10Tenants(); $powerList = $dev->GetTop10Power(); // // // Begin Report Generation // // $pdf = new PDF_Diag(); include_once "loadfonts.php"; $pdf->AliasNbPages(); $pdf->AddPage(); $colors[0] = array(100, 100, 255); $colors[1] = array(255, 100, 100); $colors[2] = array(255, 255, 100); $colors[3] = array(170, 170, 255); $colors[4] = array(0, 255, 255); $colors[5] = array(255, 0, 0); $colors[6] = array(0, 255, 0); $colors[7] = array(0, 0, 255); $colors[8] = array(100, 175, 255); $colors[9] = array(255, 175, 100); $pdf->Bookmark('Graphs'); $pdf->Bookmark('Occupancy', 1, 0);