/** * Show 3D Pie graph */ function ShowPie(&$legend, &$value) { $graph = new PieGraph(330, 200, "auto"); $graph->SetFrame(false); //$graph->title->Set("A simple 3D Pie plot"); //$graph->title->SetFont(FF_FONT1,FS_BOLD); $p1 = new PiePlot3D($value); $p1->ExplodeSlice(1); $p1->SetCenter(0.45); $p1->SetLegends($legend); $graph->legend->SetPos(0.01, 0.01, 'right', 'top'); $graph->Add($p1); $graph->Stroke(); }
function graficarTorta() { require 'jpgraph/src/jpgraph.php'; require 'jpgraph/src/jpgraph_pie.php'; require 'jpgraph/src/jpgraph_pie3d.php'; // Some data $data = array($_GET['pos'], $_GET['neg']); // Create the Pie Graph. $graph = new PieGraph(350, 300); $theme_class = new VividTheme(); $graph->SetTheme($theme_class); // Set A title for the plot // $graph->title->Set("Grafico Estadistico"); // Create $p1 = new PiePlot3D($data); $p1->ShowBorder(); $p1->SetColor('black'); $p1->ExplodeSlice(1); $p1->SetLegends(array($_GET['lab1'], $_GET['lab2'])); $p1->SetCenter(0.5, 0.4); $p1->SetAngle(40); $graph->Add($p1); $graph->Stroke(); }
function hd_partinfos_graphic($dev) { $f_name = "hd-" . md5($dev) . ".png"; $fileName = dirname(__FILE__) . "/ressources/logs/{$f_name}"; @unlink($fileName); $ydata[] = $ligne["tcount"]; $xdata[] = $ligne["sitename"] . " " . $ligne["tcount"]; $width = 700; $height = 200; $graph = new PieGraph($width, $height); $graph->title->Set("{$dev}"); $p1 = new PiePlot3D($ydata); $p1->SetLegends($xdata); $p1->ExplodeSlice(1); $graph->Add($p1); $gdImgHandler = $graph->Stroke(_IMG_HANDLER); $graph->img->Stream($fileName); return "ressources/logs/{$f_name}"; }
} if ($FG_DEBUG == 3) { echo $FG_TABLE_CLAUSE; } $list_total = $instance_table_graph->Get_list($FG_TABLE_CLAUSE, null, null, null, null, null, null); $data[] = $list_total[0][0]; $mylegend[] = $months[$current_mymonth2 - 1] . " {$current_myyear} : " . intval($list_total[0][0] / 60) . " min"; } //print_r($data); /**************************************/ //$data = array(40,60,21,33, 10, NULL); $graph = new PieGraph(475, 200, "auto"); $graph->SetShadow(); $graph->title->Set("Traffic Last {$months_compare} Months"); $graph->title->SetFont(FF_FONT1, FS_BOLD); $p1 = new PiePlot3D($data); $p1->ExplodeSlice(1); $p1->SetCenter(0.35); //print_r($gDateLocale->GetShortMonth()); //Array ( [0] => Jan [1] => Feb [2] => Mar [3] => Apr [4] => May [5] => Jun [6] => Jul [7] => Aug [8] => Sep [9] => Oct [10] => Nov [11] => Dec ) //$p1->SetLegends($gDateLocale->GetShortMonth()); $p1->SetLegends($mylegend); // Format the legend box $graph->legend->SetColor('navy'); $graph->legend->SetFillColor('gray@0.8'); $graph->legend->SetLineWeight(1); //$graph->legend->SetFont(FF_ARIAL,FS_BOLD,8); $graph->legend->SetShadow('gray@0.4', 3); //$graph->legend->SetAbsPos(10,80,'right','bottom'); $graph->Add($p1); $graph->Stroke();
function camTodayIP($zoom = false) { $day = $_GET["DAY"]; if ($day == null) { $day = date('Y-m-d'); } @mkdir($_GET["BASEPATH"], 0755, true); $f_name = "day-global-{$day}-" . __FUNCTION__ . ".png"; if ($zoom) { $f_name = "day-global-{$day}-" . __FUNCTION__ . "-zoom.png"; } $fileName = "{$_GET["BASEPATH"]}/{$f_name}"; if (is_file($fileName)) { if (file_get_time_min($fileName) < 20) { return "{$_GET["IMGPATH"]}/{$f_name}"; } } @unlink($fileName); $q = new mysql(); $sql = "SELECT COUNT(ID) as tcount, client_ip FROM `mbx_con` WHERE DATE_FORMAT(zDate,'%Y-%m-%d')='{$day}' GROUP BY client_ip ORDER BY tcount DESC LIMIT 0,10"; $results = $q->QUERY_SQL($sql, "artica_events"); while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) { $ydata[] = $ligne["tcount"]; if (strlen($ligne["client_ip"]) > 20) { $ligne["uid"] = substr($ligne["uid"], 0, 17) . "..."; } $xdata[] = $ligne["client_ip"] . " " . $ligne["tcount"]; } $width = 550; $height = 200; if ($zoom) { $width = 750; $height = 500; } $graph = new PieGraph($width, $height); $graph->title->Set("Top Public TCP/IP "); $p1 = new PiePlot3D($ydata); $p1->SetLegends($xdata); $p1->ExplodeSlice(1); $graph->Add($p1); $gdImgHandler = $graph->Stroke(_IMG_HANDLER); $graph->img->Stream($fileName); return "{$_GET["IMGPATH"]}/{$f_name}"; }
$at_least_one_data = false; for ($i = 0; $i < count($data); $i++) { if (!empty($data[$i]) && ($data[$i] < 0 || $data[$i] > 0)) { $at_least_one_data = true; } } if (!$at_least_one_data) { $data[0] = 1; } /**************************************/ $data = array_reverse($data); $graph = new PieGraph(475, 200, "auto"); $graph->SetShadow(); $graph->title->Set($title_graph); $graph->title->SetFont(FF_FONT1, FS_BOLD); $p1 = new PiePlot3D($data); $p1->ExplodeSlice(2); $p1->SetCenter(0.35); //print_r($gDateLocale->GetShortMonth()); //Array ( [0] => Jan [1] => Feb [2] => Mar [3] => Apr [4] => May [5] => Jun [6] => Jul [7] => Aug [8] => Sep [9] => Oct [10] => Nov [11] => Dec ) //$p1->SetLegends($gDateLocale->GetShortMonth()); $p1->SetLegends($mylegend); // Format the legend box $graph->legend->SetColor('navy'); $graph->legend->SetFillColor('gray@0.8'); $graph->legend->SetLineWeight(1); //$graph->legend->SetFont(FF_ARIAL,FS_BOLD,8); $graph->legend->SetShadow('gray@0.4', 3); //$graph->legend->SetAbsPos(10,80,'right','bottom'); $graph->Add($p1); $graph->Stroke();
function camWebUserFilteredDay($zoom = false) { $day = $_GET["DAY"]; if ($day == null) { $day = date('Y-m-d'); } @mkdir($_GET["BASEPATH"], 0755, true); $f_name = "day-global-users-{$day}-" . __FUNCTION__ . "-pie.png"; if ($zoom) { $f_name = "day-global-users-{$day}-" . __FUNCTION__ . "-pie-zoom.png"; } $fileName = "{$_GET["BASEPATH"]}/{$f_name}"; if (is_file($fileName)) { if (file_get_time_min($fileName) < 20) { return "{$_GET["IMGPATH"]}/{$f_name}"; } } @unlink($fileName); $q = new mysql(); $sql = "SELECT COUNT(ID) as tcount, CLIENT,TYPE FROM `dansguardian_events` \nWHERE DATE_FORMAT(zDate,'%Y-%m-%d')='{$day}' GROUP BY CLIENT,TYPE HAVING TYPE!='PASS' ORDER BY tcount DESC LIMIT 0,10"; $results = $q->QUERY_SQL($sql, "artica_events"); while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) { $ydata[] = $ligne["tcount"]; if (strlen($ligne["CLIENT"]) > 20) { $ligne["CLIENT"] = substr($ligne["uid"], 0, 17) . "..."; } $xdata[] = $ligne["CLIENT"] . " {$ligne["TYPE"]} " . $ligne["tcount"]; } $width = 700; $height = 200; if ($zoom) { $width = 750; $height = 500; } $graph = new PieGraph($width, $height); $graph->title->Set("TOP {filter} {users}"); $p1 = new PiePlot3D($ydata); $p1->SetLegends($xdata); $p1->ExplodeSlice(1); $graph->Add($p1); $gdImgHandler = $graph->Stroke(_IMG_HANDLER); $graph->img->Stream($fileName); return "{$_GET["IMGPATH"]}/{$f_name}"; }
echo $report->getErrorMessage(); exit; } // XXX ogi: Isn't it $type? if (!isset($datatype)) { $datatype = 1; } if (!$start) { $start = mktime(0, 0, 0, date('m'), 1, date('Y')); } if (!$end) { $end = time(); } else { $end--; } // Create the graph. These two calls are always required $graph = new PieGraph(640, 480, "auto"); //$graph->SetMargin(50,10,35,50); $arr['tasks'] = 'By Task'; $arr['category'] = 'By Category'; $arr['subproject'] = 'By Subproject'; $arr['user'] = '******'; $graph->title->Set("Time Report " . $arr[$type] . " (" . date('m/d/Y', $start) . "-" . date('m/d/Y', $end) . ")"); $graph->subtitle->Set($sys_name); report_pie_arr($report->labels, $report->getData()); $p1 = new PiePlot3D($pie_vals); $p1->ExplodeSlice(0); $p1->SetLegends($pie_labels); $graph->Add($p1); // Display the graph $graph->Stroke();
<?php $rutaJpGraph = "../jpgraph/src"; error_reporting(1); include "{$rutaJpGraph}/jpgraph_pie.php"; include "{$rutaJpGraph}/jpgraph_pie3d.php"; $data = array(1); $graph = new PieGraph(490, 300, "auto"); $graph->img->SetAntiAliasing(); $graph->SetMarginColor('white'); $graph->legend->Pos(0.75, 0.2); // Setup margin and titles $graph->title->SetFont(FF_FONT2, FS_NORMAL1, 5); $graph->title->Set("INFORME PQR "); $p1 = new PiePlot3D($data1y); //$_GET['datoss'][0]); $p1->SetSize(0.35); $p1->SetLabelMargin(5); $p1->SetAngle(65); $p1->SetCenter(0.52, 0.6); $p1->ExplodeSlice(3); // Setup slice labels and move them into the plot //$p1->SetLabelType(PIE_VALUE_ABS); $p1->value->SetFont(FF_FONT1, FS_BOLD, 5); $p1->value->SetColor("black"); $p1->SetLabelPos(0.6); $p1->SetLabels($nombPqrLbl, 0.2); $p1->SetLegends($nombPqr); //$_GET['nombres'][0]); $graph->Add($p1); $graph->Stroke($rutaImagen);
$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->yaxis->scale->SetGrace($options['graph_y_top'], $options['graph_y_bot']); $graph->xaxis->scale->SetGrace($options['graph_x_top'], $options['graph_x_bot']); $graph->SetMarginColor($background);
function camparmois($zoom = false) { $month = $_GET["MONTH"]; @mkdir($_GET["BASEPATH"], 0755, true); $f_name = "day-global-{$month}-pie.png"; if ($zoom) { $f_name = "day-global-{$month}-pie-zoom.png"; } $fileName = "{$_GET["BASEPATH"]}/{$f_name}"; if (is_file($fileName)) { if (file_get_time_min($fileName) < 120) { return "{$_GET["IMGPATH"]}/{$f_name}"; } } @unlink($fileName); $q = new mysql(); $sql = "SELECT SUM(emails) as tcount ,bounce_error FROM `smtp_logs_day` WHERE DATE_FORMAT(`day`,'%Y-%m')='{$_GET["MONTH"]}' GROUP BY bounce_error ORDER BY SUM(emails) DESC "; $results = $q->QUERY_SQL($sql, "artica_events"); while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) { $ydata[] = $ligne["tcount"]; if (strlen($ligne["bounce_error"]) > 15) { $ligne["bounce_error"] = substr($ligne["bounce_error"], 0, 11) . "..."; } $xdata[] = $ligne["bounce_error"] . " " . $ligne["tcount"]; } $width = 500; $height = 200; if ($zoom) { $width = 750; $height = 500; } $graph = new PieGraph($width, $height); $graph->title->Set("emails status"); $p1 = new PiePlot3D($ydata); $p1->SetLegends($xdata); $p1->ExplodeSlice(1); $graph->Add($p1); $gdImgHandler = $graph->Stroke(_IMG_HANDLER); $graph->img->Stream($fileName); return "{$_GET["IMGPATH"]}/{$f_name}"; }
public function RenderGraph(&$form, &$robj) { $data = new DataObjXYp($this->code); $form->views[$this->view]->RenderSpecial('get-data', $form, $data); $pieplot = new PiePlot3D($data->yrdata); if (is_array($this->styles['pie-options'])) { if (!empty($this->styles['pie-options']['explodeslice'])) { $pieplot->ExplodeSlice($this->styles['pie-options']['explodeslice']); } if (!empty($this->styles['pie-options']['setcenter'])) { $pieplot->SetCenter($this->styles['pie-options']['setcenter']); } } $pieplot->SetLegends(array_reverse($data->xdata)); $robj->Add($pieplot); }
function generatePie3D($data, $legend_index = 0, $chartData_index = 1, $image = false, $length = 500, $width = 300, $hasShadow = true, $fontFamily = FF_FONT1, $fontStyle = FS_BOLD, $fontSize = '', $fontColor = 'black') { include_once XHELP_JPGRAPH_PATH . '/jpgraph_pie.php'; include_once XHELP_JPGRAPH_PATH . '/jpgraph_pie3d.php'; $graph = new PieGraph($length, $width); if ($hasShadow) { // Add a shadow to the image $graph->setShadow(); } $graph->title->Set($this->meta['name']); $p1 = new PiePlot3D($data[$chartData_index]); $p1->SetSize(0.3); $p1->SetCenter(0.45); $p1->SetStartAngle(20); $p1->SetAngle(45); $p1->SetLegends($data[$legend_index]); $p1->value->SetFont($fontFamily, $fontStyle, $fontSize); $p1->value->SetColor($fontColor); $p1->SetLabelType(PIE_VALUE_PER); $a = array_search(max($data[$chartData_index]), $data[$chartData_index]); //Find the position of maximum value. $p1->ExplodeSlice($a); // Set graph background image if ($image != false) { $graph->SetBackgroundImage($image, BGIMG_FILLFRAME); } $graph->Add($p1); $graph->Stroke(); }