public function addSinglePlot($data, $x = 0.5, $y = 0.5, $title = null) { $plot = new PiePlot(array_values($data)); $plot->SetSize($this->plot_size); $plot->SetCenter($x, $y); $plot->setLabelPos(0.6); //$plot->setLegends(array_keys($data)); if ($title != null) { $plot->title->set($title); } $this->grapher->Add($plot); }
function graficarPDF() { $solo_registrados = contar("SELECT COUNT(*) FROM pasantia INNER JOIN periodo ON periodo.id = pasantia.periodo_id WHERE pasantia.m01_registrada IS NOT NULL AND pasantia.m02_aceptada IS NULL AND periodo.activo = TRUE"); $solo_aceptadas = contar("SELECT COUNT(*) FROM pasantia INNER JOIN periodo ON periodo.id = pasantia.periodo_id WHERE pasantia.m02_aceptada IS NOT NULL AND pasantia.m03_numero_asignado IS NULL AND periodo.activo = TRUE"); $solo_numero_asignado = contar("SELECT COUNT(*) FROM pasantia INNER JOIN periodo ON periodo.id = pasantia.periodo_id WHERE pasantia.m03_numero_asignado IS NOT NULL AND pasantia.m04_sellada IS NULL AND periodo.activo = TRUE"); $solo_sellada = contar("SELECT COUNT(*) FROM pasantia INNER JOIN periodo ON periodo.id = pasantia.periodo_id WHERE pasantia.m04_sellada IS NOT NULL AND pasantia.m05_entrego_copia IS NULL AND periodo.activo = TRUE"); $solo_entrego_copia = contar("SELECT COUNT(*) FROM pasantia INNER JOIN periodo ON periodo.id = pasantia.periodo_id WHERE pasantia.m05_entrego_copia IS NOT NULL AND pasantia.m06_entrego_borrador IS NULL AND periodo.activo = TRUE"); $solo_entrego_borrador = contar("SELECT COUNT(*) FROM pasantia INNER JOIN periodo ON periodo.id = pasantia.periodo_id WHERE pasantia.m06_entrego_borrador IS NOT NULL AND pasantia.m07_retiro_borrador IS NULL AND periodo.activo = TRUE"); $solo_retiro_borrador = contar("SELECT COUNT(*) FROM pasantia INNER JOIN periodo ON periodo.id = pasantia.periodo_id WHERE pasantia.m07_retiro_borrador IS NOT NULL AND pasantia.m08_entrega_final IS NULL AND periodo.activo = TRUE"); $finalizaron = contar("SELECT COUNT(*) FROM pasantia INNER JOIN periodo ON periodo.id = pasantia.periodo_id WHERE pasantia.m08_entrega_final IS NOT NULL AND periodo.activo = TRUE"); $this->MultiCell(200, 5, utf8_decode("\nRepública Bolivariana de Venezuela\nUniversidad del Zulia\nFacultad Experimental de Ciencias\nDivisión de Programas Especiales\nSistema de Pasantías\n\n\n\nEstadísticas de Hitos"), 0, "C", 0); //GENERAR LA TABLA $this->SetXY(5, 65); $this->SetFont('Arial', 'B', 12); $this->SetWidths(array(27, 25, 25, 25, 25, 25, 25, 25)); $this->SetAligns(array('C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C')); $this->Row(array("Registradas", "Aceptadas", "Numero Asignado", "Selladas", "Entrega Copia", "Entrega Borrador", "Retiro Borrador", "Finalizaron")); $this->SetX(5); $this->SetFont('Arial', '', 12); $this->SetWidths(array(27, 25, 25, 25, 25, 25, 25, 25)); $this->SetAligns(array('C', 'C', 'C', 'C', 'C', 'C', 'C', 'C')); $this->Row(array("{$solo_registrados}", "{$solo_aceptadas}", "{$solo_numero_asignado}", "{$solo_sellada}", "{$solo_entrego_copia}", "{$solo_entrego_borrador}", "{$solo_retiro_borrador}", "{$finalizaron}")); $data = array($solo_registrados, $solo_aceptadas, $solo_numero_asignado, $solo_sellada, $solo_entrego_copia, $solo_entrego_borrador, $solo_retiro_borrador, $finalizaron); //aqui va la cantidad que llevará cada parte del grafico $graph = new PieGraph(640, 480); //tamaño de la letra del titulo y la leyenda $graph->SetShadow(); $db = new PgDB(); //QUERY PARA EL PERIDO ACTIVO $queryPer = "SELECT tipo, anio FROM periodo WHERE activo = TRUE"; $recoPer = pg_query($queryPer); $rowPer = pg_fetch_array($recoPer); $graph->title->Set(utf8_decode("REPORTE TOTAL\n{$rowPer['tipo']} - {$rowPer['anio']}")); $graph->title->SetFont(FF_FONT2, FS_BOLD); $p1 = new PiePlot($data); $p1->value->Show(true); $p1->SetLegends(array("Registradas", "Aceptadas", "Numeros Asignados", "Selladas", "Entrega de Copias", "Entrega de Borrador", "Retiro de Borrador", "Finalizaron")); //la leyenda del gráfico $p1->SetSize(0.3); //el radio del gráfico //$p1->SetAngle(45); //setear el angulo $graph->Add($p1); $graph->Stroke("asd.png"); $this->Image("asd.png", -15, 85, 240, 180); // x, y, ancho, altura. $this->Image("logotipo.jpg", 20, 12, -280); unlink("asd.png"); }
function plot() { $this->_setValues(); // Create the Pie Graph. $graph = new PieGraph(500, 300); $graph->SetShadow(); // Create $p1 = new PiePlot($this->_data); // Set A title for the plot $p1->SetLegends($this->_legends); $p1->SetSize(0.3); $p1->SetCenter(0.28, 0.5); $txt = new Text("Most Visited Titles", 0.15, 0.05); $txt->SetFont(FONT1_BOLD); $graph->Add($p1); $graph->AddText($txt); $graph->Stroke(); }
function graph_pie_chart($graph_title, $graph_theme, $legend_array, $data_array, $xcoord, $ycoord) { //unlink("Images/piecharts2/pie_chart_image.png"); print "{$graph_title}"; print "{$graph_theme}"; print "{$legend_array}"; print "{$data_array}"; print "{$xcoord}"; print "{$ycoord}"; print "{$legend_array['2']}"; $graph = new PieGraph($xcoord, $ycoord); $graph->title->Set($graph_title); $graph->title->SetFont(FF_FONT1, FS_BOLD); $pie = new PiePlot($data_array); $pie->SetLegends($legend_array); $pie->SetTheme($graph_theme); //Sets the colour scheme defined in jpgraph_pie.php $graph->Add($pie); $graph->Stroke("images/piecharts2/pie_chart_image.png"); }
/** * Builds pie graph */ function buildGraph() { $this->graph = new Chart_Pie($this->width, $this->height); // title setup $this->graph->title->Set($this->title); if (is_null($this->description)) { $this->description = ""; } $this->graph->subtitle->Set($this->description); if (is_array($this->data) && array_sum($this->data) > 0) { $p = new PiePlot($this->data); $p->setSliceColors($this->graph->getThemedColors()); $p->SetCenter(0.4, 0.6); $p->SetLegends($this->legend); $p->value->HideZero(); $p->value->SetFont($this->graph->getFont(), FS_NORMAL, 8); $p->value->SetColor($this->graph->getMainColor()); $p->value->SetMargin(0); $this->graph->Add($p); } return $this->graph; }
public function createPlot() { $size = '0.25'; $plot = new \PiePlot($this->data); $plot->SetLegends($this->legends); $plot->SetSize($size); $plot->SetCenter(0.25, 0.32); $plot->ShowBorder(); $plot->SetColor('black'); $this->grafico->add($plot); }
public function executePieGraph() { //Set the response header to a image JPEG datastream $this->getResponse()->setContent('image/jpeg'); $util = new util(); //echo $duales; $data1 = $util->getDualMedia('movies'); $data2 = $util->getTotalMedia('movies') - $data1; $data = array($data2, $data1); $graph = new PieGraph(199, 120); $graph->SetMarginColor('#393939'); $graph->SetFrame(true, '#393939'); $graph->legend->SetPos(0.8, 0.9, 'center', 'bottom'); $p1 = new PiePlot($data); $p1->SetSize(0.4); $p1->SetCenter(0.45); $p1->SetSliceColors(array('white', 'red')); $p1->value->SetColor('black'); $p1->SetLegends(array("Spa", "Dual")); $p1->SetLabelPos(0.6); $graph->Add($p1); $graph->Stroke(); return sfView::NONE; }
<?php // content="text/plain; charset=utf-8" require_once 'jpgraph/jpgraph.php'; require_once 'jpgraph/jpgraph_pie.php'; $data = array(40, 60, 21, 33, 12, 33); $graph = new PieGraph(150, 150); $graph->SetShadow(); $graph->title->Set("'earth' Theme"); $graph->title->SetFont(FF_FONT1, FS_BOLD); $p1 = new PiePlot($data); $p1->SetTheme("earth"); $p1->SetCenter(0.5, 0.55); $p1->value->Show(false); $graph->Add($p1); $graph->Stroke(); ?>
function Legend(&$aGraph) { parent::Legend($aGraph); $aGraph->legend->txtcol = array_reverse($aGraph->legend->txtcol); }
<?php // content="text/plain; charset=utf6_JavaScript("../jpgraph.php6_JavaScript("../jpgraph_pie.php"); // Some data and the labels $data = array(19, 12, 4, 7, 3, 12, 3); $labels = array("First\n(%.1f%%)", "Second\n(%.1f%%)", "Third\n(%.1f%%)", "Fourth\n(%.1f%%)", "Fifth\n(%.1f%%)", "Sixth\n(%.1f%%)", "Seventh\n(%.1f%%)"); // Create the Pie Graph. $graph = new PieGraph(300, 300); $graph->SetShadow(); // Set A title for the plot $graph->title->Set('String labels with values'); $graph->title->SetFont(FF_VERDANA, FS_BOLD, 12); $graph->title->SetColor('black'); // Create pie plot $p1 = new PiePlot($data); $p1->SetCenter(0.5, 0.5); $p1->SetSize(0.3); // Setup the labels to be displayed $p1->SetLabels($labels); // This method adjust the position of the labels. This is given as fractions // of the radius of the Pie. A value < 1 will put the center of the label // inside the Pie and a value >= 1 will pout the center of the label outside the // Pie. By default the label is positioned at 0.5, in the middle of each slice. $p1->SetLabelPos(1); // Setup the label formats and what value we want to be shown (The absolute) // or the percentage. $p1->SetLabelType(PIE_VALUE_PER); $p1->value->Show(); $p1->value->SetFont(FF_ARIAL, FS_NORMAL, 9); $p1->value->SetColor('darkgray'); // Add and stroke
<?php // content="text/plain; charset=utf-8" require_once 'jpgraph/jpgraph.php'; require_once 'jpgraph/jpgraph_pie.php'; $data = array(40, 60, 21, 33); // Setup graph $graph = new PieGraph(300, 200); $graph->SetShadow(); // Setup graph title $graph->title->Set("Example 5 of pie plot"); $graph->title->SetFont(FF_FONT1, FS_BOLD); // Create pie plot $p1 = new PiePlot($data); $p1->value->SetFont(FF_VERDANA, FS_BOLD); $p1->value->SetColor("darkred"); $p1->SetSize(0.3); $p1->SetCenter(0.4); $p1->SetLegends(array("Jan", "Feb", "Mar", "Apr", "May")); //$p1->SetStartAngle(M_PI/8); $p1->ExplodeSlice(3); $graph->Add($p1); $graph->Stroke(); ?>
/** * 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; }
} else { $x[] = tr("comment"); } mysql_free_result($rsCSF); mysql_free_result($rsCSNF); mysql_free_result($rsCSC); /// A new pie graph $graph = new PieGraph(400, 200, "auto"); $graph->SetScale('textint'); $logtype = tr("by_logtype"); // Title setup $graph->title->Set($logtype); $graph->title->SetFont(FF_ARIAL, FS_NORMAL); //$graph ->legend->Pos( 0.25,0.8,"right" ,"bottom"); // Setup the pie plot $p1 = new PiePlot($y); $p1->SetTheme("earth"); $p1->value->SetFormat("%d"); $p1->SetLabelType(PIE_VALUE_ABS); $p1->SetSliceColors(array('chartreuse3', 'chocolate2', 'wheat1')); // Adjust size and position of plot $p1->SetSize(0.35); $p1->SetCenter(0.25, 0.52); $f = tr("found"); $dnf = tr("not_found"); $com = tr("comment"); // Setup slice labels and move them into the plot $xx = array($f, $dnf, $com); $p1->value->SetFont(FF_COURIER, FS_NORMAL); $p1->value->SetColor("black"); $p1->SetLabelPos(0.65);
$legenda[] = $array[0]; $tot_top10 = $tot_top10 + $array[1]; $data[] = $array[1]; } } $legenda[] = "Other Titles"; $data[] = $total - $tot_top10; // operação retirada em 02/2006 // Objetivo: aproveitar o arquivo já processada anteriormente, desde que no mesmo dia // $OP="rm -f $db_tmp_issn.* "; // $result=exec($OP); // ************************************************************** // ******** Apresentação grafico ******** // ************************************************************** $graph = new PieGraph(690, 350); // $graph->SetShadow (); // Create $p1 = new PiePlot($data); // Set A title for the plot $p1->SetLegends($legenda); $p1->SetSize(0.4); $p1->SetCenter(0.28, 0.5); $txt = new Text("Most Visited Titles", 0.15, 0.0); $txt->SetFont(FONT1_BOLD); $graph->Add($p1); $graph->AddText($txt); $graph->Stroke(); ?>
<?php require_once "../src/jpgraph.php"; require_once "../src/jpgraph_pie.php"; //模拟数据 $data = array(0 => 3.5, 1 => 4.6, 2 => 9.1, 3 => 21.9, 4 => 42.3, 5 => 90.7, 6 => 183.5, 7 => 127.5, 8 => 61.4, 9 => 33.5, 10 => 11.5, 11 => 4.4); //创建画布 $graph = new PieGraph(800, 500); //设置图像边界范围 $graph->img->SetMargin(30, 30, 80, 30); //设置标题 $graph->title->SetFont(FF_CHINESE); $graph->title->Set("饼图--PiePlot Test"); //得到饼图对象 $piePlot = new PiePlot($data); //设置图例 $piePlot->SetLegends(array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12)); //设置图例位置 $graph->legend->Pos(0.01, 0.45, "left", "top"); //添加到画布中 $graph->Add($piePlot); //输出 $graph->Stroke();
/** * * @param Integer $used * @param Integer $total */ function displayProjectProportionUsage($used, $total) { $graph = new Chart_Pie(350, 250, "auto"); $data = array($used, $total - $used); $usage = new PiePlot($data); $usage->SetSliceColors(array('#44697D', '#ACBBA4')); $usage->SetLegends(array("Used proportion", "Allowed quota")); $graph->legend->SetPos(0.01, 0, 'right', 'top'); $graph->add($usage); //graph display $graph->stroke(); }
public function executePieGraphSingers(sfWebRequest $request) { $util = new util(); $loko = $util->singersData(); //Set the response header to a image JPEG datastream $this->getResponse()->setContent('image/jpeg'); //echo $duales; $data1 = 300; $data2 = 200; // $data_results = $util->singersData(); $data = array($data2, $data1); $graph = new PieGraph(200, 174); $graph->SetMarginColor('#393939'); $graph->SetFrame(true, '#393939'); $graph->legend->SetPos(0.8, 0.9, 'center', 'bottom'); $p1 = new PiePlot($data); $p1->SetSize(0.4); $p1->SetCenter(0.45); $p1->SetSliceColors(array('white', 'red')); $p1->value->SetColor('black'); $p1->SetLegends(array("Spa", "Dual")); $p1->SetLabelPos(0.6); $graph->Add($p1); $graph->Stroke(); return sfView::NONE; }
<?php date_default_timezone_set('America/Bogota'); require_once "lib/jpgraph/src/jpgraph.php"; require_once "lib/jpgraph/src/jpgraph_pie.php"; // Se define el array de valores y el array de la leyenda if (isset($_GET['datos']) && isset($_GET['textos'])) { $d = stripslashes($_GET['datos']); $datos = unserialize($d); $t = stripslashes($_GET['textos']); $textos = unserialize($t); //$titulo = $_GET['titulo']; //Se define el grafico $grafico = new PieGraph(380, 200); //Definimos el titulo $grafico->title->Set("Grafica"); $grafico->title->SetFont(FF_FONT1, FS_BOLD); //Aâ±adimos el titulo y la leyenda $p1 = new PiePlot($datos); $p1->SetLegends($textos); $p1->SetCenter(0.2); //Se muestra el grafico $grafico->Add($p1); $grafico->Stroke(); }
<?php include "../jpgraph.php"; include "../jpgraph_pie.php"; $data = array(40, 60, 21, 33, 12, 33); $graph = new PieGraph(150, 150, "auto"); $graph->SetShadow(); $graph->title->Set("'sand' Theme"); $graph->title->SetFont(FF_FONT1, FS_BOLD); $p1 = new PiePlot($data); $p1->SetTheme("sand"); $p1->SetCenter(0.5, 0.55); $p1->value->Show(false); $graph->Add($p1); $graph->Stroke(); ?>
<?php // content="text/plain; charset=utf-8" require_once "jpgraph/jpgraph.php"; require_once "jpgraph/jpgraph_pie.php"; // Some data $data = array(27, 23, 47, 17); // A new graph $graph = new PieGraph(350, 200); $graph->SetShadow(); // Setup title $graph->title->Set("Example of pie plot with absolute labels"); $graph->title->SetFont(FF_FONT1, FS_BOLD); // The pie plot $p1 = new PiePlot($data); // Move center of pie to the left to make better room // for the legend $p1->SetCenter(0.35, 0.5); // No border $p1->ShowBorder(false); // Label font and color setup $p1->value->SetFont(FF_FONT1, FS_BOLD); $p1->value->SetColor("darkred"); // Use absolute values (type==1) $p1->SetLabelType(PIE_VALUE_ABS); // Label format $p1->value->SetFormat("\$%d"); $p1->value->Show(); // Size of pie in fraction of the width of the graph $p1->SetSize(0.3); // Legends
<?php require '../include/core/common.php'; include '../include/jpgraph/jpgraph.php'; include '../include/jpgraph/jpgraph_pie.php'; unset($data); for ($i = 1; $i <= SURVEY_MAX_ALTERNATIVES; $i++) { if (isset($_GET['alt_' . $i])) { $data[$i] = $_GET['alt_' . $i]; } } if (count($data) == 0 && is_numeric($_GET['poll_id'])) { $poll = poll_fetch(array('id' => $_GET['poll_id'])); for ($i = 1; $i <= SURVEY_MAX_ALTERNATIVES; $i++) { if (strlen($poll[0]['alt_' . $i]) > 0) { $data[$i] = $poll[0]['alt_' . $i . '_votes']; } } } $graph = new PieGraph(190, 160); $graph->SetAntiAliasing(); $graph->SetShadow(); $p1 = new PiePlot($data); $p1->ShowBorder(); $graph->SetFrame(false, 'darkblue', 2); $p1->SetSliceColors($survey_chart_colors); $graph->Add($p1); $graph->Stroke();
private function _renderPieChart($groupCount, $dimensions = '2d', $doughnut = False, $multiplePlots = False) { require_once 'jpgraph_pie.php'; if ($dimensions == '3d') { require_once 'jpgraph_pie3d.php'; } $this->_renderPiePlotArea($doughnut); $iLimit = $multiplePlots ? $groupCount : 1; for ($groupID = 0; $groupID < $iLimit; ++$groupID) { $grouping = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotGrouping(); $exploded = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotStyle(); if ($groupID == 0) { $labelCount = count($this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex(0)->getPointCount()); if ($labelCount > 0) { $datasetLabels = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex(0)->getDataValues(); $datasetLabels = $this->_formatDataSetLabels($groupID, $datasetLabels, $labelCount); } } $seriesCount = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotSeriesCount(); $seriesPlots = array(); // For pie charts, we only display the first series: doughnut charts generally display all series $jLimit = $multiplePlots ? $seriesCount : 1; // Loop through each data series in turn for ($j = 0; $j < $jLimit; ++$j) { $dataValues = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($j)->getDataValues(); // Fill in any missing values in the $dataValues array $testCurrentIndex = 0; foreach ($dataValues as $k => $dataValue) { while ($k != $testCurrentIndex) { $dataValues[$testCurrentIndex] = null; ++$testCurrentIndex; } ++$testCurrentIndex; } if ($dimensions == '3d') { $seriesPlot = new PiePlot3D($dataValues); } else { if ($doughnut) { $seriesPlot = new PiePlotC($dataValues); } else { $seriesPlot = new PiePlot($dataValues); } } if ($multiplePlots) { $seriesPlot->SetSize(($jLimit - $j) / ($jLimit * 4)); } if ($doughnut) { $seriesPlot->SetMidColor('white'); } $seriesPlot->SetColor(self::$_colourSet[self::$_plotColour++]); if (count($datasetLabels) > 0) { $seriesPlot->SetLabels(array_fill(0, count($datasetLabels), '')); } if ($dimensions != '3d') { $seriesPlot->SetGuideLines(false); } if ($j == 0) { if ($exploded) { $seriesPlot->ExplodeAll(); } $seriesPlot->SetLegends($datasetLabels); } $this->_graph->Add($seriesPlot); } } }
<?php include "inc/jpgraph.php"; include "inc/jpgraph_bar.php"; include "inc/jpgraph_pie.php"; $ydata = array(11, 20, 8, 12, 5, 1, 9, 13, 5, 7); $graph = new Graph(350, 250, "auto"); $graph->SetScale("textlin"); $graph->img->SetMargin(40, 20, 20, 40); $graph->title->Set("Empleados"); $graph->xaxis->title->Set("Mes"); $graph->yaxis->title->Set("Dinero"); $barplot = new BarPlot($ydata); $barplot->SetColor("orange"); $graph->Add($barplot); $graph->Stroke(); // Se define el array de valores y el array de la leyenda $datos = array(40, 60, 21, 33); $leyenda = array("Morenas", "Rubias", "Pelirrojas", "Otras"); //Se define el grafico $grafico = new PieGraph(450, 300); //Definimos el titulo $grafico->title->Set("Mi primer grafico de tarta"); $grafico->title->SetFont(FF_FONT1, FS_BOLD); //Añadimos el titulo y la leyenda $p1 = new PiePlot($datos); $p1->SetLegends($leyenda); $p1->SetCenter(0.4); //Se muestra el grafico $grafico->Add($p1); $grafico->Stroke();
<?php // content="text/plain; charset=utf-8" require_once 'jpgraph/jpgraph.php'; require_once 'jpgraph/jpgraph_pie.php'; $data = array(19, 12, 4, 3, 3, 12, 3, 3, 5, 6, 7, 8, 8, 1, 7, 2, 2, 4, 6, 8, 21, 23, 2, 2, 12); // Create the Pie Graph. $graph = new PieGraph(300, 350); // Set A title for the plot $graph->title->Set("Label guide lines"); $graph->title->SetFont(FF_VERDANA, FS_BOLD, 12); $graph->title->SetColor("darkblue"); $graph->legend->Pos(0.1, 0.2); // Create pie plot $p1 = new PiePlot($data); $p1->SetCenter(0.5, 0.55); $p1->SetSize(0.3); // Enable and set policy for guide-lines $p1->SetGuideLines(); $p1->SetGuideLinesAdjust(1.4); // Setup the labels $p1->SetLabelType(PIE_VALUE_PER); $p1->value->Show(); $p1->value->SetFont(FF_ARIAL, FS_NORMAL, 9); $p1->value->SetFormat('%2.1f%%'); // Add and stroke $graph->Add($p1); $graph->Stroke(); ?>
<?php include "../jpgraph.php"; include "../jpgraph_pie.php"; // Some data $data = array(113, 5, 160, 3, 15, 10, 1); // Create the Pie Graph. $graph = new PieGraph(300, 200, "auto"); $graph->SetShadow(); // Set A title for the plot $graph->title->Set("Example 1 Pie plot"); $graph->title->SetFont(FF_VERDANA, FS_BOLD, 14); $graph->title->SetColor("brown"); // Create pie plot $p1 = new PiePlot($data); //$p1->SetSliceColors(array("red","blue","yellow","green")); $p1->SetTheme("earth"); $p1->SetFont(FF_ARIAL, FS_NORMAL, 10); // Set how many pixels each slice should explode $p1->Explode(array(0, 15, 15, 25, 15)); $graph->Add($p1); $graph->Stroke(); ?>
function JpGraph() { $graph = new PieGraph(230, 200, "auto"); //$graph->SetShadow(); // Set A title for the plot $graph->title->Set($tpl->_ENGINE_parse_body("{your mailbox usage}\n ({$kb} mb free)")); $graph->title->SetFont(FF_FONT1, FS_BOLD, 12); $graph->title->SetColor("black"); $p1 = new PiePlot($data); $p1->SetSliceColors(array("red", "green", "yellow", "green")); $p1->SetTheme("water"); $p1->value->SetFont(FF_FONT1, FS_NORMAL, 10); $p1->Explode(array(0, 15, 15, 25, 15)); //$p1->SetLabelType(PIE_VALUE_PER); //$lbl = array("{used} $USER_STORAGE_USAGE","{free}"); //$p1->SetLabels($lbl); $graph->Add($p1); //$graph->img->SetAntiAliasing(); $graph->Stroke(); }
<?php include_once "../jpgraph.php"; include_once "../jpgraph_pie.php"; // Some data $data = array(40, 21, 17, 14, 23); // Create the Pie Graph. $graph = new PieGraph(300, 200, 'auto'); $graph->SetShadow(); // Set A title for the plot $graph->title->Set("Client side image map"); $graph->title->SetFont(FF_FONT1, FS_BOLD); // Create $p1 = new PiePlot($data); $p1->SetCenter(0.4, 0.5); $p1->SetLegends(array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul")); $targ = array("pie_csimex1.php#1", "pie_csimex1.php#2", "pie_csimex1.php#3", "pie_csimex1.php#4", "pie_csimex1.php#5", "pie_csimex1.php#6"); $alts = array("val=%d", "val=%d", "val=%d", "val=%d", "val=%d", "val=%d"); $p1->SetCSIMTargets($targ, $alts); $graph->Add($p1); // Send back the HTML page which will call this script again // to retrieve the image. $graph->StrokeCSIM('pie_csimex1.php'); ?>
$p1 = new PiePlot($data); $p1->SetLegends(array("Jan", "Feb", "Mar", "Apr", "May")); $p1->SetSize($size); $p1->SetCenter(0.25, 0.32); $p1->value->SetFont(FF_FONT0); $p1->title->Set("2001"); $p2 = new PiePlot($data); $p2->SetSize($size); $p2->SetCenter(0.65, 0.32); $p2->value->SetFont(FF_FONT0); $p2->title->Set("2002"); $p3 = new PiePlot($data); $p3->SetSize($size); $p3->SetCenter(0.25, 0.75); $p3->value->SetFont(FF_FONT0); $p3->title->Set("2003"); $p4 = new PiePlot($data); $p4->SetSize($size); $p4->SetCenter(0.65, 0.75); $p4->value->SetFont(FF_FONT0); $p4->title->Set("2004"); $graph->Add($p1); $graph->Add($p2); $graph->Add($p3); $graph->Add($p4); $graph->Stroke(); ?>
function StrokeLabel($label, $img, $xc, $yc, $a, $r) { if ($this->ilabelposadj === 'auto') { $this->ilabelposadj = (1 - $this->imidsize) / 2 + $this->imidsize; } parent::StrokeLabel($label, $img, $xc, $yc, $a, $r); }
<?php // content="text/plain; charset=utf-8" require_once "jpgraph/jpgraph.php"; require_once "jpgraph/jpgraph_pie.php"; $data = array(40, 60, 21, 33, 12, 33); $graph = new PieGraph(150, 150); $graph->SetShadow(); $graph->title->Set("'pastel' Theme"); $graph->title->SetFont(FF_FONT1, FS_BOLD); $p1 = new PiePlot($data); $p1->SetTheme("pastel"); $p1->SetCenter(0.5, 0.55); $p1->value->Show(false); $graph->Add($p1); $graph->Stroke(); ?>