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"); }
/** * 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 PieChart($w, $h, $title, $data, $dataL, $output) { $graph = new PieGraph($w, $h, "auto"); $graph->SetFrame(false); $graph->SetShadow(false); $graph->title->Set($title); $graph->title->SetFont(FF_FONT1, FS_BOLD); $p1 = new PiePlot3D($data); $p1->SetAngle(20); $p1->SetSize(0.5); $p1->SetCenter(0.45); $p1->SetLegends($dataL); $graph->Add($p1); $graph->Stroke($output); }
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(); }
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(); }
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(); }
array_push($targ, $_SERVER["PHP_SELF"] . "?pageId=Search&slice=1&table={$table}&excludeHost=0&host2=&host%5B%5D={$host[$y]}&excludeFacility=1&excludePriority=1&date={$date}&time=&date2={$date2}&time2=&limit=100&orderby=datetime&order=DESC&msg1=&msg2=&msg3=&collapse=1"); } else { $array_count++; } } // die(print_r($targ)); $p1->SetCSIMTargets($targ, $alts); // Horizontal: 'left','right','center' // Vertical: 'bottom','top','center' $graph->legend->SetAbsPos(10, 20, 'right', 'top'); // $graph->legend->Pos(0.5,0.5); // $graph->legend->SetColumns(2); $graph->legend->SetFont(FF_VERDANA, FS_NORMAL, 8); // Adjust size and position of plot $p1->SetSize(0.4); $p1->SetCenter(0.39, 0.6); // Setup slice labels and move them into the plot $p1->value->SetFont(FF_FONT1, FS_BOLD); $p1->value->SetColor("darkred"); $p1->SetLabelPos(0.7); // Set perM > 1 below to enable per million labels $perM = 0; if ($perM < 1) { $p1->SetLabelType(PIE_VALUE_ABS); $p1->value->SetFormat("%d"); } else { $p1->SetLabelType(PIE_VALUE_PER); $p1->value->SetFormat(".%dM"); } // Set percentage to enable per percent labels $percentage = 1;
<?php include "../jpgraph.php"; include "../jpgraph_pie.php"; include "../jpgraph_pie3d.php"; $data = array(40, 60, 21, 33); $graph = new PieGraph(300, 200, "auto"); $graph->SetShadow(); $graph->title->Set("A simple Pie plot"); $graph->title->SetFont(FF_FONT1, FS_BOLD); $p1 = new PiePlot3D($data); $p1->SetSize(0.5); $p1->SetCenter(0.45); $p1->SetLegends($gDateLocale->GetShortMonth()); $graph->Add($p1); $graph->Stroke(); ?>
} } // require_once 'ossim_conf.inc'; $conf = $GLOBALS["CONF"]; $jpgraph = $conf->get_conf("jpgraph_path"); require_once "{$jpgraph}/jpgraph.php"; require_once "{$jpgraph}/jpgraph_pie.php"; require_once "{$jpgraph}/jpgraph_pie3d.php"; // Setup the graph. $graph = new PieGraph(400, 150, "auto"); $graph->SetAntiAliasing(); $graph->SetColor("#fafafa"); $graph->SetFrame(true, '#fafafa', 0); if (isset($temp_activado)) { // Create the bar plots $piePlot3d = new PiePlot3D($data['value']); $piePlot3d->SetSliceColors(array(COLORPIE1, COLORPIE2, COLORPIE3, COLORPIE4, COLORPIE5, COLORPIE6, COLORPIE7, COLORPIE8)); //$piePlot3d->SetAngle(30); $piePlot3d->SetHeight(12); $piePlot3d->SetSize(0.5); $piePlot3d->SetCenter(0.26, 0.4); // Labels //$piePlot3d->SetLabels($data['title'],1); $piePlot3d->SetLegends($data['title']); $graph->Add($piePlot3d); $graph->legend->SetPos(0.01, 0.6, 'right', 'bottom'); } // Finally send the graph to the browser $graph->Stroke(); unset($graph);
it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. OCOMON is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Foobar; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ session_start(); include "../../includes/jpgraph/src/jpgraph.php"; include "../../includes/jpgraph/src/jpgraph_pie.php"; include "../../includes/jpgraph/src/jpgraph_pie3d.php"; $graph = new PieGraph(800, 500, "auto"); $graph->SetShadow(); $graph->SetAntiAliasing(); //$titulo=$titulo.$instituicao; $graph->title->Set($_GET['titulo']); $graph->subtitle->Set($_GET['instituicao']); $graph->title->SetFont(FF_FONT1, FS_BOLD); $p1 = new PiePlot3D($_GET['data']); $p1->ExplodeAll(); $p1->SetSize(0.45); $p1->SetCenter(0.35); $p1->SetLegends($_GET['legenda']); $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; }
// Some data $data = array(); $i = 0; $username = "******"; $selectPieGraph = "select SUM(total_Steps), SUM(total_Calories), SUM(total_Floors), SUM(total_Distance) from Data where (username = '******')"; $result = mysqli_query($connection, "{$selectPieGraph}"); while ($row = mysqli_fetch_array($result)) { $data[0] = $row["SUM(total_Steps)"]; $data[1] = $row["SUM(total_Calories)"]; $data[2] = $row["SUM(total_Floors)"]; $data[3] = $row["SUM(total_Distance)"]; } // Create the Pie Graph. $graph = new PieGraph(300, 300); $theme_class = new VividTheme(); $graph->SetTheme($theme_class); // Set A title for the plot $graph->title->Set("Breakdown of holly123's exercise"); // Create $p1 = new PiePlot3D($data); $p1->SetLegends(array("Steps", "Floors", "Calories", "Distance")); $p1->SetCenter(0.5, 0.55); $p1->SetSize(0.3); $p1->SetLabelType(PIE_VALUE_PER); $p1->value->show(); $p1->value->SetFont(FF_FONT0, FS_NORMAL, 12); $graph->Add($p1); $p1->ShowBorder(); $p1->SetColor('black'); //$p1->ExplodeSlice(1); $graph->Stroke();
$graph->Add($bplot); break; case "T": $textWidth = 56 + $maxChars * 6; $width = 600; if ($textWidth > $width) { $width = $textWidth; } $graph = new PieGraph($width, 200 + count($datax) * 32, "auto"); $graph->SetScale("textlin"); $graph->SetShadow(); $graph->legend->SetFont(FF_ARIAL, FS_NORMAL, 9); $graph->legend->SetLayout(LEGEND_VERT); $graph->legend->Pos(0.03, 0.95, "left", "bottom"); $p1 = new PiePlot3D($datax); $p1->SetAngle(30); $p1->SetCenter(0.5, 0.3); $p1->SetSize(0.4); $p1->SetTheme("pastel"); $p1->SetLegends($datay); $p1->value->Show(); $p1->value->SetFormat("%2.2f%%"); $graph->Add($p1); break; } $graph->footer->right->Set("Provincia ART"); $graph->footer->right->SetColor("#0f539c"); $graph->footer->right->SetFont(FF_FONT1, FS_BOLD); $graph->title->Set($titulo); $graph->title->SetFont(FF_ARIAL, FS_BOLD, 10); $graph->Stroke();
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 createPie($waktu, $data_pie) { require_once '../jpgraph/jpgraph.php'; require_once '../jpgraph/jpgraph_pie.php'; require_once '../jpgraph/jpgraph_pie3d.php'; // Some data $data = $data_pie; // Create the Pie Graph. $graph = new PieGraph(400, 300); $theme_class = new VividTheme(); $graph->SetTheme($theme_class); // Set A title for the plot $graph->title->Set("GRAFIK KEPATUHAN WP"); $graph->title->SetFont(FF_ARIAL, FS_BOLD, 12); // Create $p1 = new PiePlot3D($data); $p1->SetLegends(array('PATUH', 'KURANG PATUH', 'TIDAK PATUH')); $p1->SetCenter(0.5, 0.45); $p1->ShowBorder(); $p1->SetColor('black'); $graph->Add($p1); //unlink('../graphfiles/pie_kepatuhan.png'); $graph->Stroke("../graphfiles/pie_kepatuhan_" . $waktu . ".png"); }
$res5 = $DB->get_rows_array($sql5); //生成二维数组 $rows_count5 = count($res5); //声明数组 $arraynum5 = array(); $arraycip5 = array(); //解析数组 for ($n = 0; $n < $rows_count5; $n++) { array_push($arraynum5, $res5[$n][num]); array_push($arraycip5, $res5[$n][cip]); } /*************************************************************/ //创建画布 $graph = new PieGraph(320, 246); $graph->SetShadow(); //设置标题名称 $graph->title->Set("统计分析全部区域的[ 奥运会 ] 许愿比率"); $graph->title->SetFont(FF_SIMSUN, FS_BOLD); $graph->legend->SetFont(FF_SIMSUN, FS_NORMAL); $size = 0.3; /***********************统计奥运会许愿比率*************************/ //创建饼形图对象 $p = new PiePlot3D($arraynum5); $p->SetLegends($arraycip5); $p->SetSize($size); $p->SetCenter(0.45, 0.55); $p->value->SetFont(FF_FONT0); $p->title->SetFont(FF_SIMSUN, FS_BOLD); /*************************************************************/ $graph->Add($p); $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);
//生成二维数组 $rows_count = count($res); //声明数组 $arraynum0 = array(); $arraycip0 = array(); //解析数组 for ($i = 0; $i < $rows_count; $i++) { array_push($arraynum0, $res[$i][num]); array_push($arraycip0, $res[$i][cip]); } /*************************************************************/ //创建画布 $graph = new PieGraph(990, 276); $graph->SetShadow(); //设置标题名称 $graph->title->Set("应用3D饼形图统计分析全部区域许愿比率"); $graph->title->SetFont(FF_SIMSUN, FS_BOLD); $graph->legend->SetFont(FF_SIMSUN, FS_NORMAL); $size = 0.5; /***********************统计全部许愿比率*************************/ //创建饼形图对象 $p0 = new PiePlot3D($arraynum0); $p0->SetLegends($arraycip0); $p0->SetSize($size); $p0->SetCenter(0.45, 0.48); $p0->SetLegends($arraycip0); $p0->value->SetFont(FF_FONT0); $p0->title->SetFont(FF_SIMSUN, FS_BOLD); /*************************************************************/ $graph->Add($p0); $graph->Stroke();
$legends[] = $currentLabel . ' - ' . $amounts[$currentKey]->getFormatted(); } $targets = array(); foreach ($labels as $currentId => $currentLabel) { if ($currentId != 'none' && $currentId != 'other') { $targets[] = 'javascript:reachThroughCategory(\'' . substr($currentId, 1) . '\');'; } else { $targets[] = ''; } } $pie = new PiePlot3D($data); $pie->SetLegends($legends); $pie->SetCSIMTargets($targets, $dataNames); $pie->value->SetFont(FF_VERA); $pie->value->SetFormatCallback('formatPercentage'); $pie->SetCenter(0.33, 0.5); //$pie->SetSliceColors($chartColors); $graph->Add($pie); $graph->legend->SetFont(FF_VERA); $graph->legend->SetPos(0.03, 0.05); $graph->SetMargin(10, 10, 10, 10); $graph->SetShadow(); $graph->SetAntiAliasing(); $graph->StrokeCSIM(basename(__FILE__)); require_once BADGER_ROOT . "/includes/fileFooter.php"; function formatPercentage($val) { global $us; $str = sprintf('%1.2f %%', $val); return str_replace('.', $us->getProperty('badgerDecimalSeparator'), $str); }
require_once 'jpgraph/jpgraph.php'; require_once 'jpgraph/jpgraph_pie.php'; require_once 'jpgraph/jpgraph_pie3d.php'; //$gJpgBrandTiming=true; // Some data $data = array(40, 21, 17, 27, 23); // Create the Pie Graph. $graph = new PieGraph(400, 200, 'auto'); $graph->SetShadow(); // Set A title for the plot $graph->title->Set("3D Pie Client side image map"); $graph->title->SetFont(FF_FONT1, FS_BOLD); // Create $p1 = new PiePlot3D($data); $p1->SetLegends(array("Jan (%d)", "Feb", "Mar", "Apr", "May", "Jun", "Jul")); $targ = array("pie3d_csimex1.php?v=1", "pie3d_csimex1.php?v=2", "pie3d_csimex1.php?v=3", "pie3d_csimex1.php?v=4", "pie3d_csimex1.php?v=5", "pie3d_csimex1.php?v=6"); $alts = array("val=%d", "val=%d", "val=%d", "val=%d", "val=%d", "val=%d"); $p1->SetCSIMTargets($targ, $alts); // Use absolute labels $p1->SetLabelType(1); $p1->value->SetFormat("%d kr"); // Move the pie slightly to the left $p1->SetCenter(0.4, 0.5); $graph->Add($p1); // Send back the HTML page which will call this script again // to retrieve the image. $graph->StrokeCSIM(); ?>
// si todos los valores están a 0, el piegraph da el siguiente error 'Illegal pie plot. Sum of all data is zero for pie plot' $temp_activado = true; } } // require_once 'ossim_conf.inc'; $conf = $GLOBALS["CONF"]; $jpgraph = $conf->get_conf("jpgraph_path"); require_once "{$jpgraph}/jpgraph.php"; require_once "{$jpgraph}/jpgraph_pie.php"; require_once "{$jpgraph}/jpgraph_pie3d.php"; // Setup the graph. $graph = new PieGraph(350, 150, "auto"); $graph->SetAntiAliasing(); $graph->SetColor("#fafafa"); $graph->SetFrame(true, '#fafafa', 0); if (isset($temp_activado)) { // Create the bar plots $piePlot3d = new PiePlot3D($dataValue1); $piePlot3d->SetSliceColors(array(COLORPIE1, COLORPIE2, COLORPIE3, COLORPIE4, COLORPIE5, COLORPIE6, COLORPIE7, COLORPIE8)); //$piePlot3d->SetAngle(30); $piePlot3d->SetHeight(12); $piePlot3d->SetSize(0.3); $piePlot3d->SetCenter(0.5, 0.3); // Labels $piePlot3d->SetLabels(array($groupTit1, $groupTit2), 1); $graph->Add($piePlot3d); } // Finally send the graph to the browser $graph->Stroke(); unset($graph);
<?php // content="text/plain; charset=utf-8" require_once '../../vendor/autoload.php'; \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 1 3D Pie plot"); $graph->title->SetFont(FF_VERDANA, FS_BOLD, 18); $graph->title->SetColor("darkblue"); $graph->legend->Pos(0.1, 0.2); // Create pie plot $p1 = new \PiePlot3D($data); $p1->SetTheme("sand"); $p1->SetCenter(0.4); $p1->SetAngle(30); $p1->value->SetFont(FF_ARIAL, FS_NORMAL, 12); $p1->SetLegends(array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct")); $graph->Add($p1); $graph->Stroke();
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); }
/** * chartService::renderPiePlot() - draw the Pie type plot * * @param array $data plot data array reference * @param array $xmlArr xml array reference * @return object refernce Pie plot object reference */ public function renderPiePlot(&$data, &$xmlArr) { $id = $xmlArr['ATTRIBUTES']['ID']; $field = $xmlArr['ATTRIBUTES']['FIELD']; $chartType = $xmlArr['ATTRIBUTES']['CHARTTYPE']; $size = $xmlArr['ATTRIBUTES']['SIZE']; $center = $xmlArr['ATTRIBUTES']['CENTER']; $height = $xmlArr['ATTRIBUTES']['HEIGHT']; $angle = $xmlArr['ATTRIBUTES']['ANGLE']; $labelPos = $xmlArr['ATTRIBUTES']['LABELPOS']; $legendField = $xmlArr['ATTRIBUTES']['LAGENDFIELD']; if ($chartType == "Pie") { $plot = new PiePlot($data); $plot->SetLabelPos($labelPos); } else { if ($chartType == "Pie3D") { $plot = new PiePlot3D($data); $plot->SetHeight($height); $plot->SetAngle($angle); } } list($c1, $c2) = explode(',', $center); $plot->SetCenter($c1, $c2); $plot->SetSize($size); $this->_drawString($plot->value, $xmlArr['VALUE']['ATTRIBUTES']['FONT'], $xmlArr['VALUE']['ATTRIBUTES']['COLOR']); return $plot; }
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(); }