\JpGraph\JpGraph::load(); \JpGraph\JpGraph::module('pie'); \JpGraph\JpGraph::module('pie3d'); // Some data $data = array(20, 27, 45, 75, 90); // Create the Pie Graph. $graph = new \PieGraph(350, 200); $graph->SetShadow(); // Set A title for the plot $graph->title->Set("Example 5 3D Pie plot"); $graph->title->SetFont(FF_VERDANA, FS_BOLD, 18); $graph->title->SetColor("darkblue"); $graph->legend->Pos(0.1, 0.2); // Create 3D pie plot $p1 = new \PiePlot3D($data); $p1->SetTheme("sand"); $p1->SetCenter(0.4); $p1->SetSize(80); // Adjust projection angle $p1->SetAngle(45); // Adjsut angle for first slice $p1->SetStartAngle(45); // Display the slice values $p1->value->SetFont(FF_ARIAL, FS_BOLD, 11); $p1->value->SetColor("navy"); // Add colored edges to the 3D pie // NOTE: You can't have exploded slices with edges! $p1->SetEdge("navy"); $p1->SetLegends(array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct")); $graph->Add($p1); $graph->Stroke();
$graph->footer->left->SetFont(FF_VERA, FS_NORMAL, 7); // $graph->footer->right->Set ( GetAndReplaceLangStr($content['LN_STATS_GENERATEDAT'], date("Y-m-d")) ); // $graph->footer->right->SetFont( FF_VERA, FS_NORMAL, 8); // $graph->footer->left->Set ("LogAnalyzer v" . $content['BUILDNUMBER'] . "\n" . GetAndReplaceLangStr($content['LN_STATS_GENERATEDAT'], date("Y-m-d")) ); // $graph->footer->left->SetFont( FF_VERA, FS_NORMAL, 8); // $graph->footer->right->SetColor("darkred"); // Show 0 label on Y-axis (default is not to show) $graph->yscale->ticks->SupressZeroLabel(false); // Set Fonts for graph! $graph->xaxis->SetFont(FF_VERA, FS_NORMAL, 8); $graph->yaxis->SetFont(FF_VERA, FS_NORMAL, 8); $graph->legend->SetFont(FF_VERA, FS_NORMAL, 8); // Create $p1 = new PiePlot3D($YchartData); $p1->SetLegends($XchartData); $p1->SetEdge('#333333', 1); $p1->SetTheme('earth'); /* "earth" * "pastel" * "sand" * "water" */ $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);
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(); }