function create_pie_graph() { $graph = new PieGraph($this->width, $this->height, "auto"); //instantiate new PieGraph object $graph->SetShadow(); //displayed with shadow $graph->title->Set($this->title); //setup graph title $graph->title->SetFont(FF_VERDANA, FS_BOLD, 10); //set up font porperties $graph->title->SetColor("darkblue"); $p1 = new PiePlot3D($this->data); //define new 3D image for PieGraph $p1->ExplodeAll(); //explode each sector of the pie $p1->SetTheme("sand"); //set up the theme (Colors) $p1->SetCenter(0.45); //display on center $p1->SetLegends($this->label); //set up legend of the graph //$p1->SetLabel($this->label); //set up the labels of each sector of the pie graph // Setup the slice values $p1->value->SetFont(FF_ARIAL, FS_BOLD, 11); $p1->value->SetColor("navy"); $graph->Add($p1); //add 3D pie to PieGraph object $graph->Stroke(); //display grapg }
function generate_image($lang, $idx) { global $LANGUAGES; $up_to_date = get_stats($idx, $lang, 'uptodate'); $up_to_date = $up_to_date[0]; // $outdated = @get_stats($idx, $lang, 'outdated'); $outdated = $outdated[0]; // $missing = get_stats($idx, $lang, 'notrans'); $missing = $missing[0]; // $no_tag = @get_stats($idx, $lang, 'norev'); $no_tag = $no_tag[0]; $data = array($up_to_date, $outdated, $missing, $no_tag); $percent = array(); $total = array_sum($data); // Total ammount in EN manual (to calculate percentage values) $total_files_lang = $total - $missing; // Total ammount of files in translation foreach ($data as $value) { $percent[] = round($value * 100 / $total); } $legend = array($percent[0] . '%% up to date (' . $up_to_date . ')', $percent[1] . '%% outdated (' . $outdated . ')', $percent[2] . '%% missing (' . $missing . ')', $percent[3] . '%% without EN-Revision (' . $no_tag . ')'); $title = 'Details for ' . $LANGUAGES[$lang] . ' PHP Manual'; $graph = new PieGraph(530, 300); $graph->SetShadow(); $graph->title->Set($title); $graph->title->Align('left'); $graph->title->SetFont(FF_FONT1, FS_BOLD); $graph->legend->Pos(0.02, 0.18, "right", "center"); $graph->subtitle->Set('(Total: ' . $total_files_lang . ' files)'); $graph->subtitle->Align('left'); $graph->subtitle->SetColor('darkred'); $t1 = new Text(date('m/d/Y')); $t1->SetPos(522, 294); $t1->SetFont(FF_FONT1, FS_NORMAL); $t1->Align("right", 'bottom'); $t1->SetColor("black"); $graph->AddText($t1); $p1 = new PiePlot3D($data); $p1->SetSliceColors(array("#68d888", "#ff6347", "#dcdcdc", "#f4a460")); if ($total_files_lang != $up_to_date) { $p1->ExplodeAll(); } $p1->SetCenter(0.35, 0.55); $p1->value->Show(false); $p1->SetLegends($legend); $graph->Add($p1); $graph->Stroke("../www/images/revcheck/info_revcheck_php_{$lang}.png"); }
require "../../conexion.php"; $datos_genero = array(); $datos_puntaje = array(); $generos = "SELECT SUM(visitas),genero FROM juegos RIGHT JOIN genero_juego ON(juegos.id_genero=genero_juego.id_genero) GROUP BY genero\n"; $resultado_genero = mysql_query($generos) or die("Error" . $generos); while ($array_generos = mysql_fetch_array($resultado_genero)) { array_push($datos_genero, $array_generos['genero']); array_push($datos_puntaje, $array_generos['0']); } //print_r($datos_genero); //print_r($datos_puntaje); //$data = array(40,60,21,33); $graph = new PieGraph(450, 200, "auto"); $graph->img->SetAntiAliasing(); $graph->SetMarginColor('gray'); //$graph->SetShadow(); // Setup margin and titles $graph->title->Set("Cantidad de visitas según género"); $p1 = new PiePlot3D($datos_puntaje); $p1->SetSize(0.35); $p1->SetCenter(0.5); // Setup slice labels and move them into the plot $p1->value->SetFont(FF_FONT1, FS_BOLD); $p1->value->SetColor("black"); $p1->SetLabelPos(0.2); //$nombres=array("pepe","luis","miguel","alberto"); $p1->SetLegends($datos_genero); // Explode all slices $p1->ExplodeAll(); $graph->Add($p1); $graph->Stroke();
function dansguardian_buildGraph_week(){ include_once(dirname(__FILE__).'/listener.graphs.php'); $sql="SELECT COUNT( sitename ) AS tcount ,TYPE FROM `dansguardian_events` WHERE YEARWEEK( zDate ) = YEARWEEK( NOW( ) ) GROUP BY TYPE ORDER BY tcount DESC LIMIT 0 , 30"; if(isset($_GET["dansguardian-stats-query"])){return dansguardian_buildGraph_by_type();} $md5=md5($sql); $q=new mysql(); $results=$q->QUERY_SQL($sql,'artica_events'); $html="<table style='width:100%'>"; while ($ligne = mysql_fetch_array($results)) { if($ligne["TYPE"]<>null){ $data[]=$ligne["tcount"]; $labels[]=$ligne["TYPE"]; $jsa="javascript:ShowGraphDansGuardianDetails('{$ligne["TYPE"]}','week');"; $html=$html . "<tr " . CellRollOver()."> <td width=1%><img src='img/fw_bold.gif'> <td><strong style='font-size:11px'>{$ligne["tcount"]}</td> <td><strong style='font-size:11px'><a href='#' OnClick=\"$jsa\">{$ligne["TYPE"]}</a></td> </tr> "; $js[]="$jsa"; } } $html=$html."</table>"; if (!is_array($data)){ die("<center>".ICON_DANSGUARDIAN_STATISTICS()."</center>"); } $tpl=new templates(); $p1 = new PiePlot3D($data); $p1->SetSize(.4); $p1->SetAngle(75); $p1->SetCSIMTargets($js,$labels); $p1->SetCenter(0.3,0.5); $p1->ExplodeAll(10); $p1->SetLegends($labels); //$p1->SetSliceColors(array('red','blue','green','navy','orange')); $graph = new PieGraph(470,350,'auto'); $graph->Add($p1); $graph->title->Set("Week"); $graph->title->SetFont(FF_FONT1,FS_BOLD); $graph->legend->Pos(0,0,'right','top'); $graph->legend->SetFillColor('white'); $graph->legend->SetLineWeight(0); //$graph->legend->SetLayout(LEGEND_HOR); //hori $graph->legend->SetColor('black'); $graph->legend->SetShadow("white",0); $graph->SetFrame(false); if(function_exists("imageantialias")){$graph->img->SetAntiAliasing();} $mapName = 'MapName'; $imgMap = $graph->GetHTMLImageMap($mapName); $graph->Stroke("ressources/logs/$md5.png"); $html= " <table style='width:100%'> <tr> <td valign='top'> $imgMap ".RoundedLightWhite(" <img src='ressources/logs/$md5.png' alt='graph' ismap usemap='#$mapName' border='0'>")." </td> <td valign='top'>".RoundedLightWhite($html)."</td> </tr> </table> "; return $html; }
} else { $p1->SetLabelType(PIE_VALUE_PER); $p1->value->SetFormat(".%dM"); } // Set percentage to enable per percent labels $percentage = 1; if ($percentage > 0) { $p1->SetLabelType(PIE_VALUE_ABS); $p1->value->SetFormat("%d%%"); $p1->SetValueType(PIE_VALUE_PERCENTAGE); } // Set theme colors // Options are "earth", "sand", "water" and doodoo, no, I mean "pastel" :-) $p1->SetTheme("earth"); // Explode all slices $p1->ExplodeAll($topx); // Add drop shadow $aColor = "darkgray"; $p1->SetShadow($aColor); // Finally add the plot $graph->Add($p1); // ... and stroke it // $graph->Stroke(); //$ih = $graph->Stroke(_IMG_HANDLE); // $graph->StrokeCSIM("$graph_name"); $graph->Stroke($fileName); // $mapName = 'Top10'; $imgMap = $graph->GetHTMLImageMap($mapName); // die("?offset=".$offset. "PPP" .$ParamsGET); echo "{$imgMap} <TD ALIGN=\"center\"><img src=\"{$fileName}\" alt=\"{$mapName} Graph - Click on slice to drill down\" ismap usemap=\"#{$mapName}\" border=\"0\"></TD></TR>"; require_once 'includes/html_footer.php';
function crearPie($pdf, $verde, $rojo, $ciclos, $alineacion) { $data = array($verde, $rojo); $labels = array("Valores\ndentro de\nnorma\n(%.1f%%)", "Valores\nfuera de\nnorma\n(%.1f%%)"); $graph = new PieGraph(310, 200); $graph->SetShadow(); $graph->title->Set(utf8_decode("Análisis de resultados " . $ciclos)); $graph->title->SetFont(FF_FONT1, FS_BOLD); $p1 = new PiePlot3D($data); $p1->SetSize(0.5); $p1->SetCenter(0.5); $p1->ExplodeAll(15); $p1->SetStartAngle(60); $p1->SetLabels($labels); $p1->SetLabelPos(0); $p1->value->SetColor('black'); $graph->Add($p1); $p1->SetSliceColors(array('green', 'red')); //$graph->Stroke(); $nombreImagen = '' . uniqid() . '.png'; // Display the graph $graph->Stroke($nombreImagen); if ($alineacion === 'C') { $pdf->Image($nombreImagen, 145, 145, 55, 45); } elseif ($alineacion === 'L') { $pdf->Image($nombreImagen, 90, 145, 55, 45); } elseif ($alineacion === 'R') { $pdf->Image($nombreImagen, 195, 145, 55, 45); } elseif ($alineacion === 'C1') { $pdf->Image($nombreImagen, 75, 205, 55, 45); } elseif ($alineacion === 'L1') { $pdf->Image($nombreImagen, 20, 205, 55, 45); } elseif ($alineacion === 'R1') { $pdf->Image($nombreImagen, 125, 205, 55, 45); } elseif ($alineacion === 'C2') { $pdf->Image($nombreImagen, 75, 160, 55, 45); } unlink($nombreImagen); }
if ($i > 10) { unset($data['legend'][$key]); } $i++; } } $plot->SetLegends($data['legend']); $plot->setTheme($options['graph_pie_theme']); if ($options['graph_plotshadow']) { $plot->SetShadow(); } //$plot->SetStartAngle(M_PI/8); //printr($options['graph_pie_explode_pos']); switch ($options['graph_pie_explode']) { case 'all': $plot->ExplodeAll(10); break; case 'pos': $plot->ExplodeSlice((int) $options['graph_pie_explode_pos']); break; } $graph->Add($plot); } elseif ($options['graph_type'] == 'bars') { require_once "{$jpgraph}/jpgraph_bar.php"; $background = "white"; $color = "navy"; $color2 = "lightsteelblue"; // Setup graph $graph = new Graph($width, 250, "auto"); $graph->SetFrame(false); $graph->SetScale('textlin', $options['graph_y_min'], $options['graph_y_max'], $options['graph_x_min'], $options['graph_x_max']);
//$graph->legend->SetFillColor('#fafafa'); $graph->legend->SetFrameWeight(0); } else { if (intval($w) == 2) { $graph->SetMarginColor('#FFFFFF'); $graph->legend->SetShadow('#FFFFFF', 0); $graph->legend->SetFillColor('#FFFFFF'); $graph->legend->SetFrameWeight(0); } } $p1 = new PiePlot3D($data); $graph->SetFrame(false, '#ffffff'); $p1->SetSize(0.5); $p1->SetStartAngle(290); $p1->SetAngle(50); $p1->SetCenter(0.35); $p1->SetLegends($legend); //$colors=array("#C835ED", "red", "orange", "green", "#eeeeee"); //$colors=array("#C835ED", "red", "orange", "#FFD700", "#F0E68C"); $p1->SetSliceColors($colors); $p1->ExplodeAll(8); //$dplot[0]->SetFillColor("blue"); //$dplot[1]->SetFillColor("green"); //$dplot[2]->SetFillColor("navy"); //$dplot[3]->SetFillColor("orange"); //$dplot[4]->SetFillColor("magenta"); //$dplot[5]->SetFillColor("yellow"); //$dplot[6]->SetFillColor("red"); $graph->Add($p1); $graph->Stroke(); }
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(); }