public function pie_chart($piedata, $legentdata, $title) { require_once 'Examples/jpgraph/jpgraph.php'; require_once 'Examples/jpgraph/jpgraph_pie.php'; require_once 'Examples/jpgraph/jpgraph_pie3d.php'; $graph = new PieGraph(800, 450); $graph->SetShadow(); $graph->title->SetFont(FF_SIMSUN, FS_BOLD, 12); // 设置中文字体 $graph->title->Set($title . "饼状图"); $graph->SetFrame(false); $p1 = new PiePlot3D($piedata); $p1->SetSize(0.4); $p1->SetCenter(0.3); $p1->SetLegends($legentdata); $p1->SetLabelMargin(10); $graph->legend->SetFont(FF_SIMSUN, FS_NORMAL); $graph->legend->Pos(0.03, 0.18, 'right', 'top'); $graph->legend->SetLayout(LEGEND_HOR); $graph->legend->SetColumns(2); $graph->legend->SetVColMargin(0); $graph->Add($p1); $graph->SetImgFormat('png', 90); $graph->Stroke(); }
//////////////////////////////////////////////////////// ///////////////Graficas en torta para colaboradores///////////////////////////////// //////////////////////////////////////////////////////// $data = $TotalCol; $leyenda = $NombresCol; // Create the Pie Graph. $graph = new PieGraph(650, 700); //$graph->img->SetMargin(100,50,60,60); $theme_class = new VividTheme(); $graph->SetTheme($theme_class); // Set A title for the plot $graph->title->Set("A Simple 3D Pie Plot"); // Create $p1 = new PiePlot3D($data); $p1->SetLegends($leyenda); $p1->SetLabelMargin(10); $graph->Add($p1); $p1->ShowBorder(); $p1->SetColor('black'); $p1->ExplodeSlice(1); $graph->title->Set("Produccion por colaborador de {$FechaIni} a {$FechaFinal}"); $contentType = 'image/png'; $gdImgHandler = $graph->Stroke(_IMG_HANDLER); // @see http://stackoverflow.com/a/9084110/126431 ob_start(); // start buffering $graph->img->Stream(); // print data to buffer $graphData = ob_get_contents(); // retrieve buffer contents ob_end_clean();
$p1->SetCSIMTargets($chartImageMapLinks, $chartImageMapAlts, $chartImageMapTargets); // Set label format if ($content['showpercent'] == 1) { $p1->SetLabelType(0); $p1->value->SetFormat("%d%%"); } else { $p1->SetLabelType(1); $p1->value->SetFormat("%d"); } // Set label properties $p1->SetLabelPos(1.0); $p1->SetSliceColors(array('#FFF584', '#CBFF84', '#FF6B9E', '#FF9584', '#EAFF84', '#7BFF51', '#51FFA6', '#51FF52', '#6BCFFF', '#5170FF', '#519CFF', '#EAE3AD', '#FFF184', '#8584FF', '#E698FF', '#C384FF', '#FF84EC', '#FF98A3', '#E5C285', '#FFDA98')); $p1->value->SetFont(FF_VERA, FS_NORMAL, 8); $p1->value->SetColor("black"); // Adjust other Pie Properties $p1->SetLabelMargin(5); $p1->SetCenter(0.4, 0.65); $p1->SetSize(0.3); $p1->SetAngle(60); $graph->Add($p1); } else { if ($content['chart_type'] == CHART_BARS_VERTICAL) { // Include additional code filers for this chart! include_once $gl_root_path . "classes/jpgraph/jpgraph_bar.php"; include_once $gl_root_path . "classes/jpgraph/jpgraph_line.php"; // Create Basic Image, and set basic properties! $graph = new Graph($content['chart_width'], $content['chart_width'], 'auto'); $graph->SetMargin(60, 20, 30, 50); // Adjust margin area $graph->SetScale("textlin"); $graph->SetMarginColor('white');
function pie_single_mailbox_user() { $tpl = new Templates(); $users = new usersMenus(); $uid = $_SESSION["uid"]; if ($users->cyrus_imapd_installed == 0) { return null; } $ldap = new clladp(); $hash = $ldap->UserDatas($_SESSION["uid"]); if ($hash["MailboxActive"] != 'TRUE') { return null; } $cyrus = new cyrus(); $res = $cyrus->get_quota_array($uid); $size = $cyrus->MailboxInfosSize($uid); $free = $cyrus->USER_STORAGE_LIMIT - $cyrus->USER_STORAGE_USAGE; if (!$cyrus->MailBoxExists($uid)) { return null; } $USER_STORAGE_USAGE = $cyrus->USER_STORAGE_USAGE; $USER_STORAGE_LIMIT = $cyrus->USER_STORAGE_LIMIT; $FREE = $free; writelogs("USER_STORAGE_USAGE={$USER_STORAGE_USAGE}", __FUNCTION__, __FILE__); writelogs("STORAGE_LIMIT={$USER_STORAGE_LIMIT}", __FUNCTION__, __FILE__); if ($USER_STORAGE_LIMIT == null) { $USER_STORAGE_LIMIT = 1000000; $USER_STORAGE_USAGE = 0; $FREE = $USER_STORAGE_LIMIT; } $USER_STORAGE_RESTANT = $USER_STORAGE_LIMIT - $USER_STORAGE_USAGE; if ($USER_STORAGE_RESTANT > 1) { $reste = round($USER_STORAGE_RESTANT / 1024); $data = array($USER_STORAGE_USAGE, $USER_STORAGE_RESTANT); } else { $data = array($USER_STORAGE_USAGE); } $title = $tpl->_ENGINE_parse_body("{your mailbox usage} ({$reste} mb free)"); writelogs("USER_STORAGE_USAGE={$USER_STORAGE_USAGE} - USER_STORAGE_LIMIT={$USER_STORAGE_LIMIT} FREE={$FREE}", __FUNCTION__, __FILE__); $date = date('Y-m-d'); $textes = array(); $donnees = array(); $zlabel = array(); $date = date('Y-m-d'); $donnees[] = $FREE; $textes[] = "{$FREE} Free"; $donnees[] = $USER_STORAGE_USAGE; $textes[] = "{$USER_STORAGE_USAGE} used"; $data = $donnees; $graph = new PieGraph(370, 350, 'auto'); //$graph->SetShadow(); $graph->title->Set($title); $graph->title->SetFont(FF_FONT1, FS_BOLD); $p1 = new PiePlot3D($data); $p1->SetLabels($textes, 1); $p1->SetEdge('black', 0); $p1->SetAngle(55); $p1->SetLabelMargin(2); $p1->SetCenter(0.4, 0.5); $p1->ExplodeAll(10); $graph->Add($p1); $graph->SetFrame(false); $graph->StrokeCSIM(); }