Beispiel #1
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();
}
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);
}
Beispiel #3
0
 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;
 }
Beispiel #4
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;

	
}
Beispiel #5
0
 function PIE_graph($module, $method, $type, $start, $extra_fields)
 {
     global $C_translate, $C_auth;
     include_once PATH_CORE . 'validate.inc.php';
     $dt = new CORE_validate();
     include PATH_GRAPH . "jpgraph.php";
     ####################################################################
     ### Check if 'search' is authorized for this account
     ####################################################################
     # check the validation for this function
     if ($C_auth->auth_method_by_name($module, 'search')) {
         # validate this file exists, and include it.
         if (file_exists(PATH_MODULES . '/' . $module . '/' . $module . '.inc.php')) {
             include_once PATH_MODULES . '/' . $module . '/' . $module . '.inc.php';
         } else {
             ### Not exist!
             $error = $C_translate->translate('module_non_existant', '', '');
         }
     } else {
         ### Not auth
         $error = $C_translate->translate('module_non_auth', '', '');
     }
     if (isset($error)) {
         include PATH_GRAPH . "jpgraph_canvas.php";
         // Create the graph.
         $graph = new CanvasGraph(460, 55, "auto");
         $t1 = new Text($error);
         $t1->Pos(0.2, 0.5);
         $t1->SetOrientation("h");
         $t1->SetBox("white", "black", 'gray');
         $t1->SetFont(FF_FONT1, FS_NORMAL);
         $t1->SetColor("black");
         $graph->AddText($t1);
         $graph->Stroke();
         exit;
     }
     # initialize the module, if it has not already been initialized
     $eval = '$' . $module . ' = new ' . $module . '; ';
     $eval .= '$this_Obj  = $' . $module . ';';
     eval($eval);
     # run the function
     $array = call_user_func(array($module, $method), $start_str, $end_str, $constraint_array, $default_array, $extra_fields);
     include PATH_GRAPH . "jpgraph_pie.php";
     include PATH_GRAPH . "jpgraph_pie3d.php";
     $data = $array['data'];
     $legends = $array['legends'];
     // Create the Pie Graph.
     $graph = new PieGraph(500, 250, "auto");
     $graph->SetScale("textlin");
     $graph->SetMarginColor('#F9F9F9');
     $graph->SetFrame(true, '#FFFFFF', 0);
     $graph->SetColor('#F9F9F9');
     // Create pie plot
     $p1 = new PiePlot3d($data);
     $p1->SetTheme("water");
     $p1->SetCenter(0.4);
     $p1->SetAngle(30);
     $p1->value->SetFont(FF_FONT1, FS_NORMAL, 8);
     $p1->SetLegends($legends);
     // Explode the larges slice:
     $largest = 0;
     for ($i = 0; $i < count($data); $i++) {
         if ($data[$i] > $largest) {
             $largest = $data[$i];
             $explode = $i;
         }
     }
     if ($explode) {
         $p1->ExplodeSlice($explode);
     }
     $graph->Add($p1);
     $graph->Stroke();
 }
Beispiel #6
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();
 }
function grafic_trunk2(&$pDB_ast_cdr, &$pDB_ast, $module_name, $trunk, $dti, $dtf)
{
    //
    require_once "modules/{$module_name}/libs/paloSantoExtention.class.php";
    $objPalo_AST_CDR = new paloSantoExtention($pDB_ast_cdr);
    /* Si la troncal pedida es un grupo, se expande el grupo para averiguar las
       troncales individuales. */
    $regs = NULL;
    if (preg_match('!^DAHDI/(g|r)(\\d+)$!i', $trunk, $regs)) {
        $iGrupoTrunk = (int) $regs[2];
        $gruposTrunk = getTrunkGroupsDAHDI();
        if (is_array($gruposTrunk) && isset($gruposTrunk[$iGrupoTrunk])) {
            $trunk = $gruposTrunk[$iGrupoTrunk];
        }
    }
    //total minutos de llamadas in y out
    $arrayTemp = $objPalo_AST_CDR->loadTrunks($trunk, "numcall", $dti, $dtf);
    $arrResult = $arrayTemp[0];
    //$arrResult[0] => "IN"
    //$arrResult[1] => "OUT"
    $tot = $arrResult[0] + $arrResult[1];
    $usoDisco = $tot != 0 ? 100 * ($arrResult[0] / $tot) : 0;
    if ($tot != 0) {
        $freeDisco = 100 - $usoDisco;
        // Some data
        $data = array($usoDisco, $freeDisco);
        // Create the Pie Graph.
        $graph = new PieGraph(400, 170, "auto");
        //$graph->SetShadow();
        $graph->SetMarginColor('#fafafa');
        $graph->SetFrame(true, '#999999');
        $graph->legend->SetFillColor("#fafafa");
        //$graph->legend->Pos(0.012, 0.5, "right","center");
        $graph->legend->SetColor("#444444", "#999999");
        $graph->legend->SetShadow('gray@0.6', 4);
        //$graph->title->SetColor("#444444");
        // Set A title for the plot
        $graph->title->Set(utf8_decode(_tr("Number of Calls")));
        //$graph->title->SetFont(FF_VERDANA,FS_BOLD,18);
        $graph->title->SetColor("#444444");
        $graph->legend->Pos(0.04, 0.2);
        // Create 3D pie plot
        $p1 = new PiePlot3d($data);
        //$p1->SetTheme("water");
        $p1->SetSliceColors(array("#3333cc", "#9999cc", "#CC3333", "#72394a", "#aa3424"));
        $p1->SetCenter(0.3);
        $p1->SetSize(80);
        // Adjust projection angle
        $p1->SetAngle(45);
        // Adjsut angle for first slice
        $p1->SetStartAngle(45);
        // Display the slice values
        //$p1->value->SetFont(FF_ARIAL,FS_BOLD,11);
        //$p1->value->SetColor("navy");
        $p1->value->SetColor("black");
        // Add colored edges to the 3D pies
        // NOTE: You can't have exploded slices with edges!
        $p1->SetEdge("black");
        $p1->SetLegends(array(utf8_decode(_tr("Incoming Calls") . ":  ") . $arrResult[0], utf8_decode(_tr("Outcoming Calls") . ": ") . $arrResult[1]));
        $graph->Add($p1);
        $graph->Stroke();
    } else {
        $graph = new CanvasGraph(400, 140, "auto");
        $title = new Text(utf8_decode(_tr("Number of Calls")));
        $title->ParagraphAlign('center');
        $title->SetFont(FF_FONT2, FS_BOLD);
        $title->SetMargin(3);
        $title->SetAlign('center');
        $title->Center(0, 400, 70);
        $graph->AddText($title);
        $t1 = new Text(utf8_decode(_tr("There are no data to present")));
        $t1->SetBox("white", "black", true);
        $t1->ParagraphAlign("center");
        $t1->SetColor("black");
        $graph->AddText($t1);
        $graph->img->SetColor('navy');
        $graph->img->SetTextAlign('center', 'bottom');
        $graph->img->Rectangle(0, 0, 399, 139);
        $graph->Stroke();
    }
}
Beispiel #8
0
 private function createCookieGraph($xdata, $ytitle)
 {
     // Create the graph.
     $graph = new PieGraph($this->width, $this->height, "auto");
     $graph->title->SetFont(FF_FONT1, FS_NORMAL, 10);
     $graph->SetFrame(false);
     if ($this->shadow) {
         $graph->SetShadow();
     }
     $p1 = new PiePlot($xdata);
     // second group negative
     $p1->SetLegends($this->ydata1);
     $p1->SetCenter(0.3);
     $p1->SetTheme("earth");
     //color for negative prologiq "#cc00cc"
     $p1->value->SetFont(FF_FONT1, FS_NORMAL, 10);
     $graph->title->Set($ytitle);
     // ... and add it to the graph
     $graph->Add($p1);
     return $graph;
 }
<?php

// content="text/plain; charset=utf-8"
// Example of pie with center circle
require_once 'jpgraph/jpgraph.php';
require_once 'jpgraph/jpgraph_pie.php';
// Some data
$data = array(50, 28, 25, 27, 31, 20);
// A new pie graph
$piegraph = new PieGraph(400, 320);
$n = count($data);
// Number of slices
// No border around graph
$piegraph->SetFrame(false);
// Setup title
$piegraph->title->Set("CSIM Center Pie plot");
$piegraph->title->SetFont(FF_ARIAL, FS_BOLD, 18);
$piegraph->title->SetMargin(8);
// Add a little bit more margin from the top
// Create the pie plot
$p1 = new PiePlotC($data);
// Set the radius of pie (as fraction of image size)
$p1->SetSize(0.32);
// Label font and color setup
$p1->value->SetFont(FF_ARIAL, FS_BOLD, 11);
$p1->value->SetColor('white');
// Setup the title on the center circle
$p1->midtitle->Set("Distribution\n2008 H1");
$p1->midtitle->SetFont(FF_ARIAL, FS_NORMAL, 12);
// Set color for mid circle
$p1->SetMidColor('yellow');
Beispiel #10
0
/**
 * Método que sirve de reemplazo al mecanismo de paloSantoGraph y paloSantoGraphLib
 * para generar gráficos a partir de una clase que devuelve datos.
 *
 * @param   string  $module     Módulo que contiene la clase fuente de datos
 * @param   string  $class      Clase a instanciar para obtener fuente de datos
 * @param   string  $function   Método a llamar en la clase para obtener datos
 * @param   array   $arrParameters  Lista de parámetros para la invocación 
 * @param   string  $functionCB 
 */
function displayGraph($G_MODULE, $G_CLASS, $G_FUNCTION, $G_PARAMETERS, $G_FUNCTIONCB = "")
{
    //------- PARAMETROS DEL GRAPH -------
    $G_TYPE = null;
    //tipo de grafica
    $G_TITLE = null;
    //titulo
    $G_COLOR = null;
    //colores
    $G_LABEL = array();
    //etiquetas
    $G_SIZE = array();
    //tamaño
    $G_MARGIN = array();
    //margen
    $G_LEYEND_NUM_COLUMN = 1;
    $G_LEYEND_POS = array(0.05, 0.5);
    //posicion de las leyendas
    $_MSJ_ERROR = null;
    //$_MSJ_ERROR   = "Sin mensaje ERROR";
    global $_MSJ_NOTHING;
    //$_MSJ_NOTHING = "Sin mensaje NOTHING";
    $G_YDATAS = array();
    $G_ARR_COLOR = array();
    $G_ARR_FILL_COLOR = array();
    $G_ARR_LEYEND = array();
    $G_ARR_STEP = array();
    $G_SHADOW = false;
    $G_LABEL_Y = null;
    //ESTATICOS
    $G_SCALE = "textlin";
    $G_WEIGHT = 1;
    if ($G_MODULE != '') {
        require_once "modules/{$G_MODULE}/libs/{$G_CLASS}.class.php";
        //lib del modulo
        require_once "modules/{$G_MODULE}/configs/default.conf.php";
        //archivo configuracion del modulo
        global $arrConfModule;
        $dsn = isset($arrConfModule["dsn_conn_database"]) ? $arrConfModule["dsn_conn_database"] : "";
    } else {
        require_once "libs/{$G_CLASS}.class.php";
        //lib del modulo
        require_once "configs/default.conf.php";
        //archivo configuracion del modulo
        global $arrConf;
        $dsn = isset($arrConf["dsn_conn_database"]) ? $arrConf["dsn_conn_database"] : "";
    }
    $oPaloClass = new $G_CLASS($dsn);
    $arrParam = $G_PARAMETERS;
    $result = call_user_func_array(array(&$oPaloClass, $G_FUNCTION), $arrParam);
    global $globalCB;
    $globalCB = NULL;
    if ($G_FUNCTIONCB != '') {
        $globalCB = array($oPaloClass, $G_FUNCTIONCB);
    }
    //------------------- CONTRUCCION DEL ARREGLO PARA X & Y -------------------
    global $xData;
    $xData = array();
    $yData = array();
    if (sizeof($result) != 0) {
        $isX_array = false;
        //usado en LINEPLOT, PLOT3D, BARPLOT, LINEPLOT_MULTIAXIS
        foreach ($result as $att => $arrXY) {
            //------------------ ATTRIBUTES ------------------
            if ($att == 'ATTRIBUTES') {
                foreach ($arrXY as $key => $values) {
                    //VARIABLES NECESARIAS
                    if ($key == 'LABEL_X') {
                        $G_LABEL[0] = $values;
                    } else {
                        if ($key == 'LABEL_Y') {
                            $G_LABEL[1] = $values;
                        } else {
                            if ($key == 'TITLE') {
                                $G_TITLE = $values;
                            } else {
                                if ($key == 'TYPE') {
                                    $G_TYPE = $values;
                                } else {
                                    if ($key == 'SIZE') {
                                        $G_SIZE = explode(',', $values);
                                    } else {
                                        if ($key == 'MARGIN') {
                                            $G_MARGIN = explode(',', $values);
                                        } else {
                                            if ($key == 'COLOR') {
                                                $G_COLOR = $values;
                                            } else {
                                                if ($key == 'POS_LEYEND') {
                                                    $G_LEYEND_POS = explode(',', $values);
                                                } else {
                                                    if ($key == 'NUM_COL_LEYEND') {
                                                        $G_LEYEND_NUM_COLUMN = $values;
                                                    } else {
                                                        if ($key == 'SHADOW') {
                                                            $G_SHADOW = $values;
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            } else {
                if ($att == 'MESSAGES') {
                    foreach ($arrXY as $key => $values) {
                        if ($key == 'ERROR') {
                            $_MSJ_ERROR = $values;
                        } else {
                            if ($key == 'NOTHING_SHOW') {
                                $_MSJ_NOTHING = $values;
                            }
                        }
                    }
                } else {
                    if ($att == 'DATA') {
                        foreach ($arrXY as $DAT_N => $MODES) {
                            foreach ($MODES as $key => $values) {
                                /************************************************************/
                                if ($G_TYPE == 'lineplot' || $G_TYPE == 'barplot' || $G_TYPE == 'lineplot_multiaxis') {
                                    if ($key == 'VALUES') {
                                        $yData = array();
                                        foreach ($values as $x => $y) {
                                            if ($isX_array == false) {
                                                $xData[] = $x;
                                            }
                                            $yData[] = $y;
                                        }
                                        $isX_array = is_array($xData) ? true : false;
                                        $G_YDATAS[] = $yData;
                                    } else {
                                        if ($key == 'STYLE') {
                                            foreach ($values as $x => $y) {
                                                if ($x == 'COLOR') {
                                                    $G_ARR_COLOR[] = $y;
                                                } else {
                                                    if ($x == 'LEYEND') {
                                                        $G_ARR_LEYEND[] = $y;
                                                    } else {
                                                        if ($x == 'STYLE_STEP') {
                                                            $G_ARR_STEP[] = $y;
                                                        } else {
                                                            if ($x == 'FILL_COLOR') {
                                                                $G_ARR_FILL_COLOR[] = $y;
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                } else {
                                    if ($G_TYPE == 'plot3d' || $G_TYPE == 'plot3d2') {
                                        if ($key == 'VALUES') {
                                            foreach ($values as $x => $y) {
                                                $yData[] = $y;
                                            }
                                            $G_YDATAS[0] = $yData;
                                        } else {
                                            if ($key == 'STYLE') {
                                                foreach ($values as $x => $y) {
                                                    if ($x == 'COLOR') {
                                                        $G_ARR_COLOR[] = $y;
                                                    } else {
                                                        if ($x == 'LEYEND') {
                                                            $xData[] = $y;
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    } else {
                                        if ($G_TYPE == 'bar' || $G_TYPE == 'gauge') {
                                            if ($key == 'VALUES') {
                                                foreach ($values as $x => $y) {
                                                    $G_YDATAS[] = $y;
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    //*****************************************//
    //      ***** ***** ***** ***** *   *      //
    //      *     *   * *   * *   * *   *      //
    //      * *** ***** ***** ***** *****      //
    //      *   * * *   *   * *     *   *      //
    //      ***** *   * *   * *     *   *      //
    //*****************************************//
    // L I N E P L O T
    if (sizeof($G_YDATAS) >= 1) {
        // true no funciona porque cada cadena u otro valor que se retorne es valor "valido o verdadero"
        // y equivale a true, entonces para diferenciarlo verdaderamente se compara con 'true'
        $str = checkAttributes($G_TITLE, $G_TYPE, $G_LABEL_Y, $_MSJ_ERROR, $_MSJ_NOTHING);
        if ($str != 'true') {
            showError($str, $G_SIZE);
            return;
        }
        if ($G_TYPE == 'lineplot') {
            $graph = new Graph($G_SIZE[0], $G_SIZE[1], "auto");
            if ($G_SHADOW) {
                $graph->SetShadow();
            }
            $graph->SetScale($G_SCALE);
            $graph->SetMarginColor($G_COLOR);
            $graph->title->Set($G_TITLE);
            $graph->SetFrame(true, '#999999');
            $graph->img->SetMargin($G_MARGIN[0], $G_MARGIN[1], $G_MARGIN[2], $G_MARGIN[3]);
            $graph->img->SetAntiAliasing();
            $graph->xaxis->SetLabelFormatCallback("CallBack");
            $graph->xaxis->SetLabelAngle(90);
            $graph->xaxis->title->Set($G_LABEL[0]);
            $graph->yaxis->title->Set($G_LABEL[1]);
            $graph->xgrid->Show();
            $graph->legend->SetFillColor("#fafafa");
            $graph->legend->Pos($G_LEYEND_POS[0], $G_LEYEND_POS[1], "right", "center");
            $graph->legend->SetColumns($G_LEYEND_NUM_COLUMN);
            $graph->legend->SetColor("#444444", "#999999");
            $arr_lineplot = array();
            foreach ($G_YDATAS as $num => $yDatas) {
                $lineplot = new LinePlot($yDatas);
                if ($G_ARR_STEP[$num] == true) {
                    $lineplot->SetStepStyle();
                }
                if ($G_ARR_FILL_COLOR[$num] == true) {
                    $lineplot->SetFillColor($G_ARR_COLOR[$num]);
                }
                $lineplot->SetColor($G_ARR_COLOR[$num]);
                $lineplot->SetWeight($G_WEIGHT);
                $lineplot->SetLegend($G_ARR_LEYEND[$num]);
                $arr_lineplot[] = $lineplot;
            }
            foreach ($arr_lineplot as $num => $yDatas) {
                $graph->Add($yDatas);
            }
            if (sizeof($xData) > 100) {
                $graph->xaxis->SetTextTickInterval((int) (sizeof($xData) / 10));
            }
            $graph->Stroke();
        } else {
            if ($G_TYPE == 'plot3d') {
                $graph = new PieGraph($G_SIZE[0], $G_SIZE[1], "auto");
                if ($G_SHADOW) {
                    $graph->SetShadow();
                }
                $dataMarginColor = isset($result["ATTRIBUTES"]["MARGIN_COLOR"]) ? $result["ATTRIBUTES"]["MARGIN_COLOR"] : "#999999";
                $dataSizePie = isset($result["ATTRIBUTES"]["SIZE_PIE"]) ? $result["ATTRIBUTES"]["SIZE_PIE"] : "80";
                $graph->SetMarginColor($G_COLOR);
                $graph->SetFrame(true, $dataMarginColor);
                $graph->legend->Pos($G_LEYEND_POS[0], $G_LEYEND_POS[1], "right", "center");
                $graph->legend->SetFillColor("#fafafa");
                $graph->legend->SetColor("#444444", "#999999");
                $graph->legend->SetShadow('gray@0.6', 4);
                $graph->legend->SetColumns($G_LEYEND_NUM_COLUMN);
                $graph->title->Set($G_TITLE);
                $pieplot3d = new PiePlot3d($G_YDATAS[0]);
                $pieplot3d->SetSliceColors($G_ARR_COLOR);
                $pieplot3d->SetCenter(0.4);
                $pieplot3d->SetSize($dataSizePie);
                $pieplot3d->SetAngle(45);
                $pieplot3d->SetStartAngle(45);
                $pieplot3d->value->SetColor('black');
                //color a los porcentages
                $pieplot3d->SetEdge('black');
                //da color al contorno y separacion del pastel
                $pieplot3d->SetLegends($xData);
                $graph->Add($pieplot3d);
                $graph->Stroke();
            } else {
                if ($G_TYPE == 'plot3d2') {
                    if (!function_exists('displayGraph_draw_pie3d')) {
                        function displayGraph_draw_pie3d($canvasx, $ydata, $arrcolor)
                        {
                            $canvasy = $canvasx;
                            $escala = $canvasx / 320.0;
                            $iAnchoPastel = 256 * $escala;
                            $iAltoPastel = 155 * $escala;
                            $iPosCentroX = 141 * $escala;
                            $iPosCentroY = 91 * $escala;
                            $thumb = imagecreatetruecolor($canvasx * 284 / 320, $canvasy * 250 / 320);
                            $transparent = imagecolorallocatealpha($thumb, 200, 200, 200, 127);
                            imagefill($thumb, 0, 0, $transparent);
                            // Asignar colores de imagen
                            $imgcolor = array();
                            foreach ($arrcolor as $i => $sHtmlColor) {
                                $r = $g = $b = 0;
                                sscanf($sHtmlColor, "#%02x%02x%02x", $r, $g, $b);
                                $imgcolor[$i] = imagecolorallocate($thumb, $r, $g, $b);
                            }
                            $colorTexto = imagecolorallocate($thumb, 0, 0, 0);
                            // Mostrar el gráfico de pastel
                            if (!function_exists('displayGraph_pie')) {
                                function displayGraph_pie($thumb, $x, $y, $w, $h, $ydata, $G_ARR_COLOR, $colorTexto)
                                {
                                    $iTotal = array_sum($ydata);
                                    $iFraccion = 0;
                                    $etiquetas = array();
                                    for ($i = 0; $i < count($ydata); $i++) {
                                        if ($ydata[$i] >= $iTotal) {
                                            imagefilledellipse($thumb, $x, $y, $w, $h, $G_ARR_COLOR[$i]);
                                        } else {
                                            $degInicio = 360 - 45 - (int) (360.0 * ($iFraccion + $ydata[$i]) / $iTotal);
                                            $degFinal = 360 - 45 - (int) (360.0 * $iFraccion / $iTotal);
                                            imagefilledarc($thumb, $x, $y, $w, $h, $degInicio, $degFinal, $G_ARR_COLOR[$i], IMG_ARC_PIE);
                                        }
                                        $iFraccion += $ydata[$i];
                                        $degMitad = ($degInicio + $degFinal) / 2;
                                        $iPosTextoX = $x + 0.5 * ($w / 2.0) * cos(deg2rad($degMitad));
                                        $iPosTextoY = $y + 0.5 * ($h / 2.0) * sin(deg2rad($degMitad));
                                        $etiquetas[] = array($iPosTextoX, $iPosTextoY, sprintf('%.1f %%', 100.0 * $ydata[$i] / $iTotal));
                                    }
                                    /*
                                                            if (!is_null($colorTexto)) {
                                                                for ($i = 0; $i < count($ydata); $i++)
                                                                    imagestring($thumb, 5, $etiquetas[$i][0], $etiquetas[$i][1], $etiquetas[$i][2], $colorTexto);
                                                            }
                                    */
                                }
                            }
                            for ($i = (int) (60 * $escala); $i > 0; $i--) {
                                displayGraph_pie($thumb, $iPosCentroX, $iPosCentroY + $i, $iAnchoPastel, $iAltoPastel, $ydata, $imgcolor, NULL);
                            }
                            displayGraph_pie($thumb, $iPosCentroX, $iPosCentroY, $iAnchoPastel, $iAltoPastel, $ydata, $imgcolor, $colorTexto);
                            imagealphablending($thumb, true);
                            imagesavealpha($thumb, true);
                            $source2 = imagecreatefrompng("images/pie_alpha.png");
                            imagealphablending($source2, true);
                            imagecopyresampled($thumb, $source2, 0, 0, 0, 0, 290 * $escala, 294 * $escala, 290, 294);
                            header("Content-Type: image/png");
                            imagepng($thumb);
                        }
                    }
                    displayGraph_draw_pie3d($G_SIZE[0], $G_YDATAS[0], $G_ARR_COLOR);
                } else {
                    if ($G_TYPE == 'barplot') {
                        $graph = new Graph($G_SIZE[0], $G_SIZE[1], "auto");
                        if ($G_SHADOW) {
                            $graph->SetShadow();
                        }
                        $graph->SetScale($G_SCALE);
                        $graph->SetMarginColor($G_COLOR);
                        $graph->img->SetMargin($G_MARGIN[0], $G_MARGIN[1], $G_MARGIN[2], $G_MARGIN[3]);
                        $graph->title->Set($G_TITLE);
                        $graph->xaxis->title->Set($G_LABEL[0]);
                        $graph->xaxis->SetLabelFormatCallback("CallBack");
                        $graph->xaxis->SetLabelAngle(90);
                        //$graph->xaxis->SetTickLabels($xData);
                        $graph->yaxis->title->Set($G_LABEL[1]);
                        $graph->legend->SetFillColor("#fafafa");
                        $graph->legend->Pos($G_LEYEND_POS[0], $G_LEYEND_POS[1], "right", "center");
                        $graph->legend->SetColumns($G_LEYEND_NUM_COLUMN);
                        $arr_barplot = array();
                        foreach ($G_YDATAS as $num => $yDatas) {
                            $barplot = new BarPlot($yDatas);
                            $barplot->SetFillColor($G_ARR_COLOR[$num]);
                            $barplot->SetLegend($G_ARR_LEYEND[$num]);
                            $arr_barplot[] = $barplot;
                        }
                        $gbarplot = new GroupBarPlot($arr_barplot);
                        $gbarplot->SetWidth(0.6);
                        $graph->Add($gbarplot);
                        $graph->Stroke();
                    } else {
                        if ($G_TYPE == 'lineplot_multiaxis') {
                            $graph = new Graph($G_SIZE[0], $G_SIZE[1], "auto");
                            if ($G_SHADOW) {
                                $graph->SetShadow();
                            }
                            $inc = sizeof($G_YDATAS);
                            $graph->SetScale($G_SCALE);
                            $graph->SetFrame(true, '#999999');
                            $graph->title->Set($G_TITLE);
                            $graph->img->SetAntiAliasing();
                            $graph->xaxis->SetLabelFormatCallback("CallBack");
                            $graph->img->SetMargin($G_MARGIN[0], $G_MARGIN[1], $G_MARGIN[2], $G_MARGIN[3]);
                            $graph->SetMarginColor($G_COLOR);
                            $graph->legend->SetFillColor("#fafafa");
                            $graph->legend->Pos($G_LEYEND_POS[0], $G_LEYEND_POS[1], "right", "center");
                            $graph->xaxis->SetLabelAngle(90);
                            $graph->legend->SetColor("#444444", "#999999");
                            $graph->legend->SetShadow('gray@0.6', 4);
                            $graph->legend->SetColumns($G_LEYEND_NUM_COLUMN);
                            foreach ($G_YDATAS as $num => $yData) {
                                $lineplot = new LinePlot($yData);
                                $lineplot->SetWeight($G_WEIGHT);
                                $lineplot->SetLegend($G_ARR_LEYEND[$num]);
                                if ($G_ARR_STEP[$num] == true) {
                                    $lineplot->SetStepStyle();
                                }
                                if ($G_ARR_FILL_COLOR[$num] == true) {
                                    $lineplot->SetFillColor($G_ARR_COLOR[$num]);
                                }
                                if ($num == 0) {
                                    $lineplot->SetColor($G_ARR_COLOR[$num]);
                                    $graph->yaxis->SetColor($G_ARR_COLOR[$num]);
                                    $graph->Add($lineplot);
                                } else {
                                    $lineplot->SetColor($G_ARR_COLOR[$num]);
                                    $graph->SetYScale($num - 1, 'lin');
                                    $graph->ynaxis[$num - 1]->SetColor($G_ARR_COLOR[$num]);
                                    $graph->ynaxis[$num - 1]->SetPosAbsDelta($G_MARGIN[1] + 49 * ($num - 1));
                                    //mueve el eje Y
                                    $graph->AddY($num - 1, $lineplot);
                                }
                            }
                            if (sizeof($xData) > 100) {
                                //$graph->xaxis->SetTextLabelInterval( (int)(sizeof($xData)/8) );
                                $graph->xaxis->SetTextTickInterval((int) (sizeof($xData) / 10));
                                //$graph->xaxis->SetTextTickInterval( 9*(int)(log(sizeof($xData))-1) );
                            }
                            $graph->Stroke();
                        } else {
                            if ($G_TYPE == 'bar') {
                                $g = new CanvasGraph(91, 21, 'auto');
                                $g->SetMargin(0, 0, 0, 0);
                                $g->InitFrame();
                                $xmax = 20;
                                $ymax = 20;
                                $scale = new CanvasScale($g);
                                $scale->Set(0, $G_SIZE[0], 0, $G_SIZE[1]);
                                //DUBUJA LA BARRA
                                $alto = $G_SIZE[1];
                                $ancho = $G_SIZE[0];
                                $coor_x = 0;
                                $coor_y = 0;
                                $porcentage = $G_YDATAS[0];
                                $valor = 90 * (1 - $porcentage);
                                $g->img->Line($coor_x, $coor_y, $coor_x + $ancho, $coor_y);
                                $g->img->Line($coor_x, $coor_y, $coor_x, $coor_y + $alto);
                                $g->img->Line($coor_x + $ancho, $coor_y, $coor_x + $ancho, $coor_y + $alto);
                                $g->img->Line($coor_x, $coor_y + $alto, $coor_x + $ancho, $coor_y + $alto);
                                for ($i = 0; $i < $alto; $i++) {
                                    $g->img->SetColor(array(95 - 3 * $i, 138 - 3 * $i, 203 - 3 * $i));
                                    //para hacerlo 3D, degradacion
                                    $g->img->Line($coor_x, $coor_y + $i + 1, $coor_x + $ancho - $valor - 1, $coor_y + $i + 1);
                                }
                                $g->Stroke();
                            } else {
                                if ($G_TYPE == 'gauge') {
                                    if (!function_exists('displayGraph_draw_gauge')) {
                                        function displayGraph_draw_gauge($canvasx, $percent)
                                        {
                                            $escala = $canvasx / 320.0;
                                            $thumb = imagecreatetruecolor($canvasx * 284 / 320, $canvasx * 284 / 320);
                                            if ($percent > 100) {
                                                $percent = 100.0;
                                            }
                                            if ($percent < 0) {
                                                $percent = 0.0;
                                            }
                                            $angle = -135.0 + 270 * $percent / 100.0;
                                            // COLORES
                                            $blanco = imagecolorallocate($thumb, 255, 255, 255);
                                            $dred = imagecolorallocate($thumb, 180, 0, 0);
                                            $lred = imagecolorallocate($thumb, 100, 0, 0);
                                            $transparent = imagecolorallocatealpha($thumb, 200, 200, 200, 127);
                                            imagefill($thumb, 0, 0, $transparent);
                                            imagealphablending($thumb, true);
                                            imagesavealpha($thumb, true);
                                            $source = imagecreatefrompng("images/gauge_base.png");
                                            imagealphablending($source, true);
                                            imagecopyresampled($thumb, $source, 0, 0, 0, 0, 285 * $escala, 285 * $escala, 285, 285);
                                            $radius = 100 * $escala;
                                            $radius_min = 12 * $escala;
                                            $centrox = 142 * $escala;
                                            $centroy = 141 * $escala;
                                            $x1 = $centrox + sin(deg2rad($angle)) * $radius;
                                            // x coord farest
                                            $x2 = $centrox + sin(deg2rad($angle - 90)) * $radius_min;
                                            $x3 = $centrox + sin(deg2rad($angle + 90)) * $radius_min;
                                            $y1 = $centroy - cos(deg2rad($angle)) * $radius;
                                            $y2 = $centroy - cos(deg2rad($angle - 90)) * $radius_min;
                                            $y3 = $centroy - cos(deg2rad($angle + 90)) * $radius_min;
                                            $arrTriangle1 = array($centrox, $centroy, $x1, $y1, $x2, $y2);
                                            $arrTriangle2 = array($centrox, $centroy, $x1, $y1, $x3, $y3);
                                            imagefilledpolygon($thumb, $arrTriangle1, 3, $lred);
                                            imagefilledpolygon($thumb, $arrTriangle2, 3, $dred);
                                            $source2 = imagecreatefrompng("images/gauge_center.png");
                                            imagealphablending($source2, true);
                                            imagecopyresampled($thumb, $source2, 121 * $escala, 120 * $escala, 0, 0, 44 * $escala, 44 * $escala, 44, 44);
                                            header("Content-Type: image/png");
                                            imagepng($thumb);
                                        }
                                    }
                                    displayGraph_draw_gauge($G_SIZE[0], $G_YDATAS[0] * 100.0);
                                } else {
                                    if ($G_TYPE == 'bar2') {
                                        $alto = 20;
                                        $ancho = 90;
                                        $coor_x = 100;
                                        $coor_y = 10;
                                        $porcentage = 0.67;
                                        $valor = 90 * (1 - $porcentage);
                                        $g = new CanvasGraph($G_LEN_X, 40, 'auto');
                                        $g->SetMargin(1, 1, 31, 9);
                                        $g->SetMarginColor('#fafafa');
                                        $g->SetColor(array(250, 250, 250));
                                        $g->InitFrame();
                                        $xmax = 20;
                                        $ymax = 20;
                                        $scale = new CanvasScale($g);
                                        $scale->Set(0, $G_LEN_X, 0, $G_LEN_Y);
                                        //DUBUJA LA BARRA
                                        $g->img->Line($coor_x, $coor_y, $coor_x + $ancho, $coor_y);
                                        $g->img->Line($coor_x, $coor_y, $coor_x, $coor_y + $alto);
                                        $g->img->Line($coor_x + $ancho, $coor_y, $coor_x + $ancho, $coor_y + $alto);
                                        $g->img->Line($coor_x, $coor_y + $alto, $coor_x + $ancho, $coor_y + $alto);
                                        for ($i = 0; $i < $alto; $i++) {
                                            $g->img->SetColor(array(95 - 4 * $i, 138 - 4 * $i, 203 - 4 * $i));
                                            //para hacerlo 3D, degradacion
                                            $g->img->Line($coor_x, $coor_y + $i, $coor_x + $ancho - $valor - 1, $coor_y + $i);
                                        }
                                        //AGREGA LABEL 1
                                        $txt = "Uso de CPU";
                                        $t = new Text($txt, 10, 12);
                                        $t->font_style = FS_BOLD;
                                        $t->Stroke($g->img);
                                        //AGREGA LABEL 2
                                        $txt = "67.64% used of 2,200.00 MHz";
                                        $t = new Text($txt, 200, 12);
                                        $t->font_style = FS_BOLD;
                                        $t->Stroke($g->img);
                                        $g->Stroke();
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    } else {
        showError('nothing', $G_SIZE, $G_TITLE);
    }
}
 public function graficar_pastel()
 {
     $sql = "call PRGetGraficaDias('{$this->fecha_inicial}','{$this->fecha_final}');";
     $res = mysql_query($sql);
     while ($row = mysql_fetch_array($res)) {
         $datos[] = $row["Contador"];
         $labels[] = $row["Estado"];
     }
     if (empty($datos)) {
         echo 'No existe datos a mostrarse.';
     } else {
         // A new graph
         $graph = new PieGraph(1000, 800, 'auto');
         $graph->SetFrame(false);
         $graph->img->SetAntiAliasing();
         // Setup title
         $graph->title->Set("Porcentaje de Personas que Entran - Salen");
         $graph->title->SetFont(FF_ARIAL, FS_BOLD, 22);
         $graph->title->SetMargin(20);
         // The pie plot
         $p1 = new PiePlotC($datos);
         $p1->SetSliceColors(array('hotpink', 'aquamarine3'));
         // Move center of pie to the left to make better room
         // for the legend
         $p1->SetSize(0.3);
         // Set color for mid circle
         $p1->SetMidColor('white');
         $p1->SetCenter(0.5, 0.4);
         $p1->value->SetFont(FF_ARIAL, FS_BOLD, 20);
         $p1->value->SetColor('white');
         $p1->value->Show();
         $p1->SetLabelType(PIE_VALUE_PER);
         $lbl = array("%.1f%%", "%.1f%%");
         $p1->SetLabels($lbl);
         $p1->ExplodeAll(10);
         // Legends
         $p1->SetLegends(array("ENTRA", "SALE"));
         $graph->legend->SetFont(FF_ARIAL, FS_BOLD, 15);
         $graph->legend->SetPos(0.5, 0.4, 'center', 'bottom');
         $graph->legend->SetColumns(2);
         $graph->Add($p1);
         $graph->Stroke();
     }
 }
Beispiel #12
0
 $graph->title->SetFont(FF_FONT1, FS_BOLD);
 if (intval($w) == 1) {
     $graph->SetMarginColor('#FAFAFA');
     $graph->legend->SetShadow('#fafafa', 0);
     //$graph->legend->SetFillColor('#fafafa');
     $graph->legend->SetFrameWeight(0);
 } else {
     if (intval($w) == 2) {
         $graph->SetMarginColor('#FFFFFF');
         $graph->legend->SetShadow('#FFFFFF', 0);
         $graph->legend->SetFillColor('#FFFFFF');
         $graph->legend->SetFrameWeight(0);
     }
 }
 $p1 = new PiePlot3D($data);
 $graph->SetFrame(false, '#ffffff');
 $p1->SetSize(0.5);
 $p1->SetStartAngle(290);
 $p1->SetAngle(50);
 $p1->SetCenter(0.35);
 $p1->SetLegends($legend);
 //$colors=array("#C835ED", "red", "orange", "green", "#eeeeee");
 //$colors=array("#C835ED", "red", "orange", "#FFD700", "#F0E68C");
 $p1->SetSliceColors($colors);
 $p1->ExplodeAll(8);
 //$dplot[0]->SetFillColor("blue");
 //$dplot[1]->SetFillColor("green");
 //$dplot[2]->SetFillColor("navy");
 //$dplot[3]->SetFillColor("orange");
 //$dplot[4]->SetFillColor("magenta");
 //$dplot[5]->SetFillColor("yellow");
Beispiel #13
0
 public function grafico_distribucion_tipo_resp($id_asignacionprueba)
 {
     require_once APPPATH . '/libraries/JpGraph/jpgraph_pie.php';
     $this->rendimiento_global($id_asignacionprueba);
     $data_circ = array($this->totalcorrectas, $this->totalincorrectas, $this->totalomitidas);
     $columnas_circ = array('Correctas', 'Incorrectas', 'Omitidas');
     $graph_circ = new PieGraph(400, 320);
     $graph_circ->title->Set("Distribución por Tipo de Respuesta");
     $graph_circ->SetMarginColor("#fff");
     $graph_circ->SetFrame(true, '#fff', 1);
     $graph_circ->SetBox(false);
     $p1 = new PiePlot($data_circ);
     $p1->ExplodeSlice(0);
     $p1->SetCenter(0.5);
     //$p1->SetLegends('Correctas','Incorrectas','Omitidas');
     $p1->SetLegends($columnas_circ);
     // No border
     $p1->ShowBorder(false);
     $graph_circ->legend->SetPos(0.1, 0.996, 'left', 'bottom');
     $graph_circ->legend->SetFrameWeight(1);
     $p1->SetGuideLines(true, false);
     $p1->SetGuideLinesAdjust(1.5);
     $p1->SetLabelType(PIE_VALUE_PER);
     $p1->value->Show();
     $p1->SetSliceColors(array('#1d71b8', '#ea1d25', 'orange'));
     $graph_circ->Add($p1);
     $graph_circ->Stroke(_IMG_HANDLER);
     global $img_graf_dist_resp;
     $this->img_graf_dist_resp = "assets/images/graf_dist_resp.jpg";
     $graph_circ->img->Stream($this->img_graf_dist_resp);
     /*
     $graph_circ->img->Headers();
     $graph_circ->img->Stream();
     */
 }
Beispiel #14
0
//$graph->subtitle->SetFont(FF_FONT0,FS_NORMAL);
$p1 = new PiePlot($data);
$p1->ExplodeSlice(0);
// make the largest slice explode out from the rest
#$p1->ExplodeAll();
//$p1->SetStartAngle(45);
if (imgdef($q['slices']['border'], 0) == 0) {
    $p1->ShowBorder(false, false);
}
$p1->SetGuideLines();
$p1->SetCenter(0.35);
$p1->SetTheme(imgdef($q['slices']['theme'], 'earth'));
$p1->SetLegends($labels);
$p1->SetGuideLinesAdjust(1.1);
$graph->SetMarginColor(imgdef($q['frame']['margin'], '#d7d7d7'));
$graph->SetFrame(true, imgdef($q['frame']['color'], 'gray'), imgdef($q['frame']['width'], 1));
$graph->Add($p1);
/*
if (count($data)) {
	$t = new Text("Not enough history\navailable\nto display piechart");
	$t->SetPos(0.5,0.5,'center','center');
	$t->SetFont(FF_FONT2, FS_BOLD);
	$t->ParagraphAlign('centered');
	$t->SetBox('lightyellow','black','gray');
	$t->SetColor('orangered4');
//	$graph->legend->Hide();
	$graph->AddText($t);
}
*/
stdImgFooter($graph);
$graph->Stroke();
Beispiel #15
0
 public function create_graph($width = 600, $height = 200, $data, $title, $xaxis, $yaxis, $type = "bar")
 {
     require_once 'jpgraph/jpgraph.php';
     require_once 'jpgraph/jpgraph_line.php';
     require_once 'jpgraph/jpgraph_bar.php';
     require_once 'jpgraph/jpgraph_pie.php';
     // Create a graph instance
     if ($type == "bar" || $type == "line") {
         $graph = new Graph($width, $height);
     } else {
         if ($type == "pie") {
             $graph = new PieGraph($width, $height);
         }
     }
     // Specify what scale we want to use,
     // int = integer scale for the X-axis
     // int = integer scale for the Y-axis
     $graph->SetScale('intint');
     $graph->SetMarginColor("lightblue:1.1");
     $graph->SetShadow();
     $graph->SetMargin(60, 20, 10, 40);
     // Box around plotarea
     $graph->SetBox();
     // No frame around the image
     $graph->SetFrame(false);
     // Setup a title for the graph
     $graph->title->Set($title);
     $graph->title->SetMargin(8);
     $graph->title->SetColor("darkred");
     // Setup the X and Y grid
     $graph->ygrid->SetFill(true, '#DDDDDD@0.5', '#BBBBBB@0.5');
     $graph->ygrid->SetLineStyle('dashed');
     $graph->ygrid->SetColor('gray');
     $graph->xgrid->Show();
     $graph->xgrid->SetLineStyle('dashed');
     $graph->xgrid->SetColor('gray');
     // Setup titles and X-axis labels, if it's array, first row is title
     if (is_array($xaxis)) {
         $graph->xaxis->title->Set($xaxis[0]);
         $xaxis = array_slice($xaxis, 1, count($xaxis) - 1);
         $graph->xaxis->SetTickLabels($xaxis);
     } else {
         $graph->xaxis->title->Set($xaxis);
     }
     // no array, just show name
     // Setup Y-axis title
     $graph->yaxis->title->SetMargin(10);
     $graph->yaxis->title->Set($yaxis);
     if ($type == "bar") {
         $plot = new BarPlot($data);
         $plot->SetWidth(0.6);
         $fcol = '#440000';
         $tcol = '#FF9090';
         $plot->SetFillGradient("navy:0.9", "navy:1.85", GRAD_LEFT_REFLECTION);
         //$plot->SetColor("black");
         // Set line weigth to 0 so that there are no border
         // around each bar
         $plot->SetWeight(0);
         // Add the plot to the graph
         $graph->Add($plot);
     } else {
         if ($type == "line") {
             $plot = new LinePlot($data);
             $plot->SetFillColor('skyblue@0.5');
             $plot->SetColor('navy@0.7');
             $plot->mark->SetType(MARK_SQUARE);
             $plot->mark->SetColor('blue@0.5');
             $plot->mark->SetFillColor('lightblue');
             $plot->mark->SetSize(5);
             // Add the plot to the graph
             $graph->Add($plot);
         } else {
             if ($type == "pie") {
                 $plot = new PiePlot($data);
                 $plot->SetCenter(0.5, 0.55);
                 $plot->SetSize(0.2);
                 // Enable and set policy for guide-lines
                 $plot->SetGuideLines();
                 $plot->SetGuideLinesAdjust(1.4);
                 // Setup the labels
                 $plot->SetLabelType(PIE_VALUE_PER);
                 $plot->value->Show();
                 //$plot->value->SetFont(FF_ARIAL,FS_NORMAL,9);
                 $plot->value->SetFormat('%2.1f%%');
                 $plot->ExplodeSlice(1);
                 $plot->SetGuideLines(true);
                 $graph->SetMarginColor("white");
                 $plot->SetLegends($xaxis);
                 // Add the plot to the graph
                 $graph->Add($plot);
             } else {
                 die($type . " is not known graph type");
             }
         }
     }
     // Display the graph
     $fn = strtolower($title);
     $fn = str_replace(" ", "", $fn);
     $filename_relative = "site/web_app/images/dynamic/{$fn}.jpg";
     $filename_full = __DIR__ . "/" . $filename_relative;
     $graph->Stroke($filename_full);
     $imglink = "<img src='{$filename_relative}' title='{$title}' />\n";
     return $imglink;
 }
Beispiel #16
0
<?php

include "../jpgraph.php";
include "../jpgraph_pie.php";
include "../jpgraph_pie3d.php";
// Some data
$data = array(200, 27, 45, 75, 90);
// Create the Pie Graph.
$graph = new PieGraph(400, 300, "auto");
$graph->SetFrame(true, 'darkblue', 0);
//$theme_class= new VividTheme;
//$graph->SetTheme($theme_class);
// 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("pastel");
$p1->SetCenter(0.5);
$p1->SetAngle(60);
$p1->SetSliceColors(array('red', 'blue', 'green', 'navy', 'orange'));
//$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();
?>


Beispiel #17
0
         die('No map id given');
     }
     require_once 'core/jpgraph/jpgraph_pie.php';
     // Get data
     $wins = $db->GetRow("SELECT mapstat_alien_wins,\n                                mapstat_human_wins,\n                                mapstat_ties + mapstat_draws AS ties\n                         FROM map_stats WHERE mapstat_id = ?", array($_GET['map_id']));
     if ($wins['mapstat_alien_wins'] + $wins['mapstat_human_wins'] + $wins['ties'] > 0) {
         $data = array($wins['mapstat_alien_wins'], $wins['mapstat_human_wins'], $wins['ties']);
     } else {
         $data = array(0, 0, 1);
     }
     // Build graph
     $g = new PieGraph(200, 120);
     $g->SetMargin(30, 30, 10, 25);
     $g->SetMarginColor('#22262a');
     $g->SetColor('#22262a');
     $g->SetFrame(true, array(0, 0, 0), 0);
     $g->SetBox(false);
     // Build plot
     $p1 = new PiePlot($data);
     $p1->SetCenter(40, 60);
     $p1->SetSliceColors(array('#CC0000', '#0055FF', '#888888'));
     $p1->value->show(false);
     $legends = array('Aliens (%d%%)', 'Humans (%d%%)', 'Tied (%d%%)');
     $p1->SetLegends($legends);
     $g->legend->SetShadow(false);
     $g->legend->SetAbsPos(10, 60, 'right', 'center');
     // Stroke
     $g->Add($p1);
     $g->Stroke();
     break;
 case 'map_balance':
Beispiel #18
0
function graph_pie($p_metrics, $p_title = '', $p_graph_width = 500, $p_graph_height = 350, $p_center = 0.4, $p_poshorizontal = 0.1, $p_posvertical = 0.09)
{
    $t_graph_font = graph_get_font();
    error_check(is_array($p_metrics) ? array_sum($p_metrics) : 0, $p_title);
    $graph = new PieGraph($p_graph_width, $p_graph_height);
    $graph->img->SetMargin(40, 40, 40, 100);
    $graph->title->Set($p_title);
    $graph->title->SetFont($t_graph_font, FS_BOLD);
    $graph->SetMarginColor('white');
    $graph->SetFrame(false);
    $graph->legend->Pos($p_poshorizontal, $p_posvertical);
    $graph->legend->SetFont($t_graph_font);
    $p1 = new PiePlot3d(array_values($p_metrics));
    // should be reversed?
    $p1->SetTheme('earth');
    #$p1->SetTheme("sand");
    $p1->SetCenter($p_center);
    $p1->SetAngle(60);
    $p1->SetLegends(array_keys($p_metrics));
    # Label format
    $p1->value->SetFormat('%2.0f');
    $p1->value->Show();
    $p1->value->SetFont($t_graph_font);
    $graph->Add($p1);
    if (helper_show_queries()) {
        $graph->subtitle->Set(db_count_queries() . ' queries (' . db_count_unique_queries() . ' unique) (' . db_time_queries() . 'sec)');
        $graph->subtitle->SetFont($t_graph_font, FS_NORMAL, 8);
    }
    $graph->Stroke();
}
        // 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(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
Beispiel #20
0
 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;
 }
 /**
  * Runs the phpOpenTracker API call.
  *
  * @param  array $parameters
  * @return mixed
  * @access public
  */
 function run($parameters)
 {
     global $lang, $c;
     $parameters['api_call'] = 'top';
     $parameters['result_format'] = 'separate_result_arrays';
     $apicall = array('api_call' => 'top', 'result_format' => 'separate_result_arrays', 'what' => $parameters["what"], 'start' => $parameters["start"], 'end' => $parameters["end"], 'client_id' => 1, 'limit' => $parameters["limit"]);
     list($names, $values, $percent, $total) = phpOpenTracker::get($apicall);
     $percent_others = 100.0;
     $values_others = 0;
     for ($j = 0; $j < $parameters['limit']; $j++) {
         $percent_others = $percent_others - $percent[$j];
         $values_others = $values_others + $values[$j];
         if (is_numeric($names[$j])) {
             $names[$j] = resolvePage($names[$j]);
         }
     }
     array_push($percent, $percent_others);
     array_push($names, $lang->get("others", "Others"));
     array_push($values, $values_others * $percent_others / 100);
     $title = 'Top ' . $parameters['limit'] . ' ';
     switch ($parameters['what']) {
         case 'document':
             $title .= 'Pages';
             break;
         case 'entry_document':
             $title .= 'Entry Pages';
             break;
         case 'exit_document':
             $title .= 'Exit Pages';
             break;
         case 'exit_target':
             $title .= 'Exit Targets';
             break;
         case 'host':
             $title .= 'Hosts';
             break;
         case 'operating_system':
             $title .= 'Operating Systems';
             break;
         case 'referer':
             $title .= 'Referers';
             break;
         case 'user_agent':
             $title .= 'Browsers';
             break;
     }
     $title .= " (Total: {$total})";
     for ($i = 0, $numValues = sizeof($values); $i < $numValues; $i++) {
         $legend[$i] = sprintf('%s (%s, %s%%%%)', $names[$i], $values[$i], $percent[$i]);
     }
     $graph = new PieGraph($parameters['width'], $parameters['height'], 'auto');
     $graph->title->Set($title);
     if ($c["usettf"]) {
         $graph->title->SetFont(FF_ARIAL, FS_NORMAL, 8);
     }
     $graph->title->SetColor('black');
     $graph->legend->Pos(0.5, 0.6, "center", "top");
     $graph->legend->SetFillColor("white");
     $graph->legend->SetShadow(0);
     //$graph->legend->SetFrame(0);
     if ($c["usettf"]) {
         $graph->legend->SetFont(FF_ARIAL, FS_NORMAL, 8);
     }
     $graph->SetFrame(0);
     $plot = new PiePlot3d($percent);
     $plot->SetTheme('nx');
     $plot->SetCenter(0.5, 0.3);
     $plot->SetAngle(45);
     if ($c["usettf"]) {
         $plot->value->SetFont(FF_ARIAL, FS_NORMAL, 8);
     }
     $plot->SetLegends($legend);
     $graph->Add($plot);
     $graph->img->SetAntiAliasing("white");
     $graph->Stroke();
 }
Beispiel #22
0
function graph_pie($p_metrics, $p_title = '', $p_graph_width = 500, $p_graph_height = 350, $p_center = 0.4, $p_poshorizontal = 0.1, $p_posvertical = 0.09)
{
    $t_graph_font = graph_get_font();
    error_check(is_array($p_metrics) ? array_sum($p_metrics) : 0, $p_title);
    if (plugin_config_get('eczlibrary') == ON) {
        $graph = new ezcGraphPieChart();
        $graph->title = $p_title;
        $graph->background->color = '#FFFFFF';
        $graph->options->font = $t_graph_font;
        $graph->options->font->maxFontSize = 12;
        $graph->legend = false;
        $graph->data[0] = new ezcGraphArrayDataSet($p_metrics);
        $graph->data[0]->color = '#FFFF00';
        $graph->renderer = new ezcGraphRenderer3d();
        $graph->renderer->options->dataBorder = false;
        $graph->renderer->options->pieChartShadowSize = 10;
        $graph->renderer->options->pieChartGleam = 0.5;
        $graph->renderer->options->pieChartHeight = 16;
        $graph->renderer->options->legendSymbolGleam = 0.5;
        $graph->driver = new ezcGraphGdDriver();
        //$graph->driver->options->supersampling = 1;
        $graph->driver->options->jpegQuality = 100;
        $graph->driver->options->imageFormat = IMG_JPEG;
        $graph->renderer->options->syncAxisFonts = false;
        $graph->renderToOutput($p_graph_width, $p_graph_height);
    } else {
        $graph = new PieGraph($p_graph_width, $p_graph_height);
        $graph->img->SetMargin(40, 40, 40, 100);
        $graph->title->Set($p_title);
        $graph->title->SetFont($t_graph_font, FS_BOLD);
        $graph->SetMarginColor('white');
        $graph->SetFrame(false);
        $graph->legend->Pos($p_poshorizontal, $p_posvertical);
        $graph->legend->SetFont($t_graph_font);
        $p1 = new PiePlot3d(array_values($p_metrics));
        // should be reversed?
        $p1->SetTheme('earth');
        # $p1->SetTheme("sand");
        $p1->SetCenter($p_center);
        $p1->SetAngle(60);
        $p1->SetLegends(array_keys($p_metrics));
        # Label format
        $p1->value->SetFormat('%2.0f');
        $p1->value->Show();
        $p1->value->SetFont($t_graph_font);
        $graph->Add($p1);
        if (helper_show_query_count()) {
            $graph->subtitle->Set(db_count_queries() . ' queries (' . db_time_queries() . 'sec)');
            $graph->subtitle->SetFont($t_graph_font, FS_NORMAL, 8);
        }
        $graph->Stroke();
    }
}
Beispiel #23
0
function ejecutarGrafico($value_criteria, $date_start, $date_end)
{
    global $arrLang;
    $data_graph = leerDatosGrafico($value_criteria, $date_start, $date_end);
    if (count($data_graph["values"]) > 0) {
        // Create the Pie Graph.
        $graph = new PieGraph(630, 220, "auto");
        $graph->SetMarginColor('#fafafa');
        $graph->SetFrame(true, '#999999');
        $graph->legend->SetFillColor("#fafafa");
        $graph->legend->SetColor("#444444", "#999999");
        $graph->legend->SetShadow('gray@0.6', 4);
        // Set A title for the plot
        $graph->title->Set(utf8_decode($data_graph["title"]));
        $graph->title->SetColor("#444444");
        $graph->legend->Pos(0.1, 0.2);
        // Create 3D pie plot
        $p1 = new PiePlot3d($data_graph["values"]);
        $p1->SetCenter(0.4);
        $p1->SetSize(100);
        // Adjust projection angle
        $p1->SetAngle(60);
        // Adjsut angle for first slice
        $p1->SetStartAngle(45);
        // Display the slice values
        $p1->value->SetColor("black");
        // Add colored edges to the 3D pie
        // NOTE: You can't have exploded slices with edges!
        $p1->SetEdge("black");
        $p1->SetLegends($data_graph["legend"]);
        $graph->Add($p1);
        $graph->Stroke();
    } else {
        $graph = new CanvasGraph(630, 220, "auto");
        $title = new Text(utf8_decode($data_graph["title"]));
        $title->ParagraphAlign('center');
        $title->SetFont(FF_FONT2, FS_BOLD);
        $title->SetMargin(3);
        $title->SetAlign('center');
        $title->Center(0, 630, 110);
        $graph->AddText($title);
        $t1 = new Text(utf8_decode($arrLang["No records found"]));
        $t1->SetBox("white", "black", true);
        $t1->ParagraphAlign("center");
        $t1->SetColor("black");
        $graph->AddText($t1);
        $graph->img->SetColor('navy');
        $graph->img->SetTextAlign('center', 'bottom');
        $graph->img->Rectangle(0, 0, 629, 219);
        $graph->Stroke();
        /*
               //no hay datos - por ahora muestro una imagen en blanco con mensaje no records found
                header('Content-type: image/png');
                $titulo=utf8_decode($data_graph["title"]);
                $im = imagecreate(630, 220);
                $background_color = imagecolorallocate($im, 255, 255, 255);
                $text_color = imagecolorallocate($im, 233, 14, 91);
                imagestring($im, 10, 5, 5, $titulo. "  -  No records found", $text_color);
                imagepng($im);
                imagedestroy($im);*/
    }
}
Beispiel #24
0
<?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();
Beispiel #25
0
 public function grafico_3_bd()
 {
     require_once APPPATH . '/libraries/JpGraph/jpgraph_pie.php';
     $data_circ = $this->id_asignacionprueba;
     $columnas_circ = array('Correctas', 'Omitidas', 'Incorrectas');
     $graph_circ = new PieGraph(500, 400);
     $graph_circ->title->Set("Grafico 3 - circular o de pastel");
     $graph_circ->SetMarginColor("#fff");
     $graph_circ->SetFrame(true, '#fff', 1);
     $graph_circ->SetBox(false);
     $p1 = new PiePlot($data_circ);
     $p1->ExplodeSlice(0);
     $p1->SetCenter(0.5);
     $p1->SetLegends($this->id_asignacionprueba);
     $graph_circ->legend->SetPos(0.2, 0.99, 'right', 'bottom');
     $graph_circ->legend->SetFrameWeight(1);
     $p1->SetGuideLines(true, false);
     $p1->SetGuideLinesAdjust(1.5);
     $p1->SetLabelType(PIE_VALUE_PER);
     $p1->value->Show();
     $graph_circ->Add($p1);
     $graph_circ->Stroke(_IMG_HANDLER);
     global $fileName_bd_3;
     $this->fileName_bd_3 = "assets/images/grafica_muestra_bd_3.jpg";
     $graph_circ->img->Stream($this->fileName_bd_3);
     /*
     $graph_circ->img->Headers();
     $graph_circ->img->Stream();
     */
 }
Beispiel #26
0
 /**
  * 环形图
  */
 function createring($title, $data = array(), $size = 40, $height = 100, $width = 80, $legend = array())
 {
     // Example of pie with center circle
     vendor("Jpgraph.jpgraph");
     vendor("Jpgraph.jpgraph_pie");
     // Some data
     //$data = array(50,28,25,27,30,30);
     // A new pie graph
     $graph = new PieGraph(700, 350, 'auto');
     //$graph->SetShadow();
     // Setup title
     $graph->title->Set(iconv("utf-8", "gb2312", "{$title}"));
     $graph->title->SetFont(FF_SIMSUN, FS_BOLD, 14);
     $graph->title->SetMargin(2);
     // Add a little bit more margin from the top
     $graph->legend->Pos(0.1, 0.1);
     $graph->SetFrame(false, '#ffffff', 0);
     //去掉周围的边框
     // Create the pie plot
     $p1 = new PiePlotC($data);
     // Set size of pie
     $p1->SetTheme("sand");
     $p1->SetCenter(0.4);
     $p1->SetSize(0.35);
     // Label font and color setup
     $p1->value->SetFont(FF_ARIAL, FS_BOLD, 10);
     $p1->value->SetColor('black');
     // Setup the title on the center circle
     $p1->midtitle->Set("");
     $p1->midtitle->SetFont(FF_SIMSUN, FS_NORMAL, 10);
     // Set color for mid circle
     $p1->SetMidColor('white');
     // Use percentage values in the legends values (This is also the default)
     $p1->SetLabelType(PIE_VALUE_PER);
     $graph->legend->SetFont(FF_SIMSUN, FS_NORMAL, 8);
     //编码转化
     foreach ($legend as $k => $v) {
         $legend[$k] = iconv('utf-8', 'gb2312', $v);
     }
     $p1->SetLegends($legend);
     // Add plot to pie graph
     $graph->Add($p1);
     // .. and send the image on it's marry way to the browser
     $graph->Stroke();
 }
Beispiel #27
0
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();
}