Beispiel #1
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);
     }
 }
Beispiel #2
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");
}
 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");
     }
 }
    }
}
//
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);
Beispiel #5
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();
     $p1->SetLegends($XchartData);
     $p1->SetEdge('#333333', 1);
     $p1->SetTheme('earth');
     /*   "earth"    * "pastel"    * "sand"    * "water" */
     $p1->SetCSIMTargets($chartImageMapLinks, $chartImageMapAlts, $chartImageMapTargets);
     // Set label format
     if ($content['showpercent'] == 1) {
         $p1->SetLabelType(0);
         $p1->value->SetFormat("%d%%");
     } else {
         $p1->SetLabelType(1);
         $p1->value->SetFormat("%d");
     }
     // Set label properties
     $p1->SetLabelPos(1.0);
     $p1->SetSliceColors(array('#FFF584', '#CBFF84', '#FF6B9E', '#FF9584', '#EAFF84', '#7BFF51', '#51FFA6', '#51FF52', '#6BCFFF', '#5170FF', '#519CFF', '#EAE3AD', '#FFF184', '#8584FF', '#E698FF', '#C384FF', '#FF84EC', '#FF98A3', '#E5C285', '#FFDA98'));
     $p1->value->SetFont(FF_VERA, FS_NORMAL, 8);
     $p1->value->SetColor("black");
     // Adjust other Pie Properties
     $p1->SetLabelMargin(5);
     $p1->SetCenter(0.4, 0.65);
     $p1->SetSize(0.3);
     $p1->SetAngle(60);
     $graph->Add($p1);
 } else {
     if ($content['chart_type'] == CHART_BARS_VERTICAL) {
         // Include additional code filers for this chart!
         include_once $gl_root_path . "classes/jpgraph/jpgraph_bar.php";
         include_once $gl_root_path . "classes/jpgraph/jpgraph_line.php";
         // Create Basic Image, and set basic properties!
         $graph = new Graph($content['chart_width'], $content['chart_width'], 'auto');
Beispiel #7
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");
    //$dplot[6]->SetFillColor("red");
    $graph->Add($p1);
    $graph->Stroke();
}