function createPie3D($pValues = "")
{
    // Some data
    $values = array("2010" => 1950, "2011" => 750, "2012" => 2100, "2013" => 580, "2014" => 5000, "2015" => 5000, "2016" => 5000, "2017" => 5000);
    if ($pValues) {
        $values = $pValues;
    }
    $total = count($values);
    $data = $total == 0 ? array(360) : array_values($values);
    $keys = $total == 0 ? array("") : array_keys($values);
    // Create the Pie Graph.
    $graph = new PieGraph(380, 400);
    $theme_class = new VividTheme();
    $graph->SetTheme($theme_class);
    // Set A title for the plot
    //$graph->title->Set("A Simple 3D Pie Plot");
    // Create
    $p1 = new PiePlot3D($data);
    $p1->SetLegends($keys);
    $graph->Add($p1);
    $p1->ShowBorder();
    $p1->SetColor('black');
    $p1->ExplodeSlice(1);
    $graph->Stroke();
}
Example #2
0
 public function graficoPDF($datos = array(), $nombreGrafico = NULL, $ubicacionTamamo = array(), $titulo = NULL)
 {
     //construccion de los arrays de los ejes x e y
     if (!is_array($datos) || !is_array($ubicacionTamamo)) {
         echo "los datos del grafico y la ubicacion deben de ser arreglos";
     } elseif ($nombreGrafico == NULL) {
         echo "debe indicar el nombre del grafico a crear";
     } else {
         #obtenemos los datos del grafico
         //echo json_encode($datos);
         foreach ($datos as $key => $value) {
             if ($value['estatus'] === $value['contador']) {
                 $data[] = $value['contador'];
                 $nombres[] = $value['parroquia'] . ' (' . $value['contador'] . ')';
             } else {
                 if ($value['estatus'] === 'tipo') {
                     $data[] = $value['contador'];
                     $nombres[] = $value['sector'] . ' (' . $value['contador'] . ')';
                 } else {
                     if ($value['estatus'] === 'sector') {
                         $data[] = $value['contador'];
                         $nombres[] = $value['tipo'] . ' (' . $value['contador'] . ')';
                     } else {
                         if ($value['estatus'] != $value['contador']) {
                             $data[] = $value['contador'];
                             $nombres[] = $value['estatus'] . ' (' . $value['contador'] . ')';
                         }
                     }
                 }
             }
         }
         $x = $ubicacionTamamo[0];
         $y = $ubicacionTamamo[1];
         $ancho = $ubicacionTamamo[2];
         $altura = $ubicacionTamamo[3];
         $color[] = ['red', 'blue', 'yellow', 'green', 'orange', 'pink', 'purple', 'silver', 'olive', 'grey', 'lime', 'sky blue', 'black', 'brown'];
         #Creamos un grafico vacio
         $graph = new PieGraph(400, 300);
         #indicamos titulo del grafico si lo indicamos como parametro
         if (!empty($titulo)) {
             $graph->title->Set($titulo);
         }
         //Creamos el plot de tipo tarta
         $p1 = new PiePlot3D($data);
         $p1->SetSliceColors($color);
         #indicamos la leyenda para cada porcion de la tarta
         $p1->SetLegends($nombres);
         //Añadirmos el plot al grafico
         $graph->Add($p1);
         //mostramos el grafico en pantalla
         unlink("{$nombreGrafico}.png");
         $graph->Stroke("{$nombreGrafico}.png");
         $this->Image("{$nombreGrafico}.png", $x, $y, $ancho, $altura);
     }
 }
Example #3
0
/**
 * 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();
}
Example #4
0
 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
 }
Example #5
0
 public function gaficoPDF($datos = array(), $nombreGrafico = NULL, $ubicacionTamamo = array(), $titulo = NULL)
 {
     //construccion de los arrays de los ejes x e y
     if (!is_array($datos) || !is_array($ubicacionTamamo)) {
         echo "los datos del grafico y la ubicacion deben de ser arreglos";
     } elseif ($nombreGrafico == NULL) {
         echo "debe indicar el nombre del grafico a crear";
     } else {
         #obtenemos los datos del grafico
         foreach ($datos as $key => $value) {
             $data[] = $value[0];
             $nombres[] = $key;
             $color[] = $value[1];
         }
         $x = $ubicacionTamamo[0];
         $y = $ubicacionTamamo[1];
         $ancho = $ubicacionTamamo[2];
         $altura = $ubicacionTamamo[3];
         #Creamos un grafico vacio
         $graph = new PieGraph(600, 400);
         #indicamos titulo del grafico si lo indicamos como parametro
         if (!empty($titulo)) {
             $graph->title->Set($titulo);
         }
         //Creamos el plot de tipo tarta
         $p1 = new PiePlot3D($data);
         $p1->SetSliceColors($color);
         #indicamos la leyenda para cada porcion de la tarta
         $p1->SetLegends($nombres);
         //Añadirmos el plot al grafico
         $graph->Add($p1);
         //mostramos el grafico en pantalla
         $graph->Stroke("{$nombreGrafico}.png");
         $this->Image("{$nombreGrafico}.png", $x, $y, $ancho, $altura);
         unlink("{$nombreGrafico}.png");
     }
 }
Example #6
0
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");
}
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);
}
Example #8
0
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}";
}
Example #10
0
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;

	
}
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();
         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();
Example #13
0
//生成二维数组
$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();
Example #14
0
<?php

error_reporting(E_ERROR);
ini_set("display_errors", 1);
include "../common/jpgraph/jpgraph.php";
include "../common/jpgraph/jpgraph_pie.php";
include "../common/jpgraph/jpgraph_pie3d.php";
$data = unserialize($_GET['pcts']);
$graph = new PieGraph(600, 300, "auto");
$graph->SetShadow();
$graph->title->Set("Namespace totals");
$graph->title->SetFont(FF_FONT1, FS_BOLD);
$p1 = new PiePlot3D($data);
$p1->SetSize(0.5);
$p1->SetCenter(0.35);
$p1->SetLegends(unserialize($_GET['nsnames']));
$p1->SetSliceColors(unserialize($_GET['colors']));
$graph->Add($p1);
$graph->Stroke();
Example #15
0
    }
    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();
 /**
  * Collects and renders user per group report data
  */
 public function user_per_group()
 {
     $myConfig = $this->getConfig();
     $oDb = oxDb::getDb();
     global $aTitles;
     $aDataX = array();
     $aDataY = array();
     $sSQL = "SELECT oxgroups.oxtitle,\n                        count(oxuser.oxid)\n                 FROM oxobject2group,\n                      oxuser,\n                      oxgroups\n                 WHERE oxobject2group.oxobjectid = oxuser.oxid  AND\n                       oxobject2group.oxgroupsid = oxgroups.oxid\n                 GROUP BY oxobject2group.oxgroupsid\n                 ORDER BY oxobject2group.oxgroupsid";
     $rs = $oDb->execute($sSQL);
     if ($rs != false && $rs->recordCount() > 0) {
         while (!$rs->EOF) {
             if ($rs->fields[1]) {
                 $aDataX[] = $rs->fields[1];
                 $aDataY[] = $rs->fields[0];
             }
             $rs->moveNext();
         }
     }
     header("Content-type: image/png");
     // New graph with a drop shadow
     if (count($aDataX) > 10) {
         $graph = new PieGraph(800, 830);
     } else {
         $graph = new PieGraph(600, 600);
     }
     $graph->setBackgroundImage($myConfig->getImageDir(true) . "/reportbgrnd.jpg", BGIMG_FILLFRAME);
     $graph->setShadow();
     // Set title and subtitle
     //$graph->title->set($this->aTitles[$myConfig->getConfigParam( 'iAdminLanguage' ) ]);
     $graph->title->set($this->aTitles[oxRegistry::getLang()->getObjectTplLanguage()]);
     // Use built in font
     $graph->title->setFont(FF_FONT1, FS_BOLD);
     // Create the bar plot
     $bplot = new PiePlot3D($aDataX);
     $bplot->setSize(0.4);
     $bplot->setCenter(0.5, 0.32);
     // explodes all chunks of Pie from center point
     $bplot->explodeAll(10);
     $iUserCount = 0;
     foreach ($aDataX as $iVal) {
         $iUserCount += $iVal;
     }
     for ($iCtr = 0; $iCtr < count($aDataX); $iCtr++) {
         $iSLeng = strlen($aDataY[$iCtr]);
         if ($iSLeng > 20) {
             if ($iSLeng > 23) {
                 $aDataY[$iCtr] = trim(substr($aDataY[$iCtr], 0, 20)) . "...";
             }
         }
         $aDataY[$iCtr] .= " - " . $aDataX[$iCtr] . " Kund.";
     }
     $bplot->setLegends($aDataY);
     if (count($aDataX) > 10) {
         $graph->legend->pos(0.49, 0.66, 'center');
         $graph->legend->setFont(FF_FONT0, FS_NORMAL);
         $graph->legend->setColumns(4);
     } else {
         $graph->legend->pos(0.49, 0.7, 'center');
         $graph->legend->setFont(FF_FONT1, FS_NORMAL);
         $graph->legend->setColumns(2);
     }
     $graph->add($bplot);
     // Finally output the  image
     $graph->stroke();
 }
Example #17
0
<?php

include "lib/jpgraph/src/jpgraph.php";
include "lib/jpgraph/src/jpgraph_pie.php";
include "lib/jpgraph/src/jpgraph_pie3d.php";
$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("Ejemplo: Horas de Trabajo");
$p1 = new PiePlot3D($data);
$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($nombres);
// Explode all slices
$p1->ExplodeAll();
$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}";
}
    }
}
//
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);
Example #20
0
// 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();
Example #21
0
 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();
 }
Example #22
0
$graph->SetShadow();
// Title setup
/* cdukes - 2-28-08: Added a test to notify the user if they selected more TopX than what was available in the database
    Example: Selecting Top 100 when only 50 hosts are in the DB
	 */
$numhosts = count($host);
// die("Hostcount:$numhosts \nTopx: $topx\n");
if ($numhosts >= $topx) {
    $graph->title->Set("Top {$topx} Hosts of " . $totalrows . " total messages");
} else {
    $graph->title->Set("Top {$numhosts} Hosts of " . $totalrows . " total messages\n(Unable to get Top {$topx}, You only have {$numhosts} hosts in the database)");
    $topx = $numhosts;
}
$graph->title->SetFont(FF_FONT1, FS_BOLD);
// Setup the pie plot
$p1 = new PiePlot3D($count);
$p1->SetLegends($host);
$targ = array();
//count number of hosts for pie slices
$array_count = count($host);
for ($y = 0; $y < $array_count; $y++) {
    if (isset($host[$y])) {
        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'
Example #23
0
// content="text/plain; charset=utf-8"
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();
?>
Example #24
0
$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();
Example #25
0
<?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();
?>


 function parse($input, $parser)
 {
     global $jpgraphLabelType;
     foreach (split("\n", $input) as $line) {
         // skip empty line or comments
         if (preg_match("/^(\\s*)#.*\$|^(\\s*)\$/", $line)) {
             continue;
         }
         // Storing data
         $raw_data = split($this->fieldsep, $line);
         if (count($raw_data) == 2) {
             $this->labels[] = $raw_data[0];
             $this->datay[] = $raw_data[1];
         } else {
             $this->datay[] = $raw_data[0];
         }
     }
     if ($this->is3d) {
         $pie = new PiePlot3D($this->datay);
         $pie->SetAngle($this->angle);
     } else {
         $pie = new PiePlot($this->datay);
     }
     if ($this->center) {
         $tmp = split(",", $this->center);
         if (is_array($tmp) && count($tmp) == 2) {
             $pie->SetCenter($tmp[0], $tmp[1]);
         } else {
             if (is_array($tmp) && count($tmp) == 1) {
                 $pie->SetCenter($tmp[0]);
             }
         }
     }
     if ($this->labeltype) {
         $label_type = $jpgraphLabelType[$this->labeltype];
         if (!$label_type) {
             throw new JpgraphMWException("Unknown label type(" . $this->labeltype . "). Possible values are: " . implode(", ", array_keys($jpgraphLabelType)));
         }
         $pie->SetLabelType($label_type);
     }
     if ($this->labelformat) {
         $pie->value->SetFormat($this->labelformat);
     }
     if ($this->usettf) {
         $pie->value->SetFont($this->font);
     }
     $pie->value->Show($this->showlabel);
     $explode_pie_list = split(",", $this->explode);
     if (count($explode_pie_list) == 1) {
         $pie->ExplodeAll($explode_pie_list[0]);
     } else {
         $pie->Explode($explode_pie_list);
     }
     if (count($this->labels) == count($this->datay)) {
         $pie->SetLegends($this->labels);
     }
     $this->graph->Add($pie);
 }
Example #27
0
<?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();
<?php
$graph = new PieGraph(500,300,"auto");
$graph->SetShadow();
//$graph->title->Set($_SESSION[rekmed][statistik_kunjungan_semua_keadaan_keluar][title]);
//$graph->title->SetFont(FF_FONT1,FS_BOLD);

$p1 = new PiePlot3D($_SESSION[rekmed][statistik_kunjungan_semua_keadaan_keluar][jml]);
$p1->ExplodeAll();
$p1->SetCenter(0.5);
$p1->SetLabels($_SESSION[rekmed][statistik_kunjungan_semua_keadaan_keluar][nama]);
//$p1->SetLegends($_SESSION[rekmed][statistik_kunjungan_semua_keadaan_keluar][kode]);
$graph->Add($p1);
$graph->Stroke();
?>
Example #29
0
 /**
  * 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;
 }
Example #30
0
    $data[$i] = $row["SUM({$category})"];
    $i++;
}
// TESTS
//for ($i=0; $i < sizeof($users) ; $i++) {
//echo"<p>$users[$i]</p>";
//}
//for ($i=0; $i < sizeof($data) ; $i++) {
//	echo"<p>$data[$i]</p>";
//}
// Create the Pie Graph.
$graph = new PieGraph(300, 300);
$theme_class = new UniversalTheme();
$graph->SetTheme($theme_class);
// Set A title for the plot
$graph->title->Set("Breakdown of {$category}");
// Create
$p1 = new PiePlot3D($data);
$p1->SetLegends($users);
$p1->SetCenter(0.5, 0.4);
$p1->SetSize(0.5);
$p1->SetLabelType(PIE_VALUE_PER);
$p1->value->show();
$p1->value->SetFont(FF_FONT0, FS_NORMAL, 12);
//$graph->SetMarginColor('khaki:0.6');
//$graph->SetFrame(true,'khaki:0.2',1);
$graph->Add($p1);
$p1->ShowBorder();
//$p1->SetColor('black');
//$p1->ExplodeSlice(1);
$graph->Stroke();