コード例 #1
0
ファイル: pieex5.php プロジェクト: Lazaro-Gallo/psmn
<?php

// content="text/plain; charset=utf-8"
require_once 'jpgraph/jpgraph.php';
require_once 'jpgraph/jpgraph_pie.php';
$data = array(40, 60, 21, 33);
// Setup graph
$graph = new PieGraph(300, 200);
$graph->SetShadow();
// Setup graph title
$graph->title->Set("Example 5 of pie plot");
$graph->title->SetFont(FF_FONT1, FS_BOLD);
// Create pie plot
$p1 = new PiePlot($data);
$p1->value->SetFont(FF_VERDANA, FS_BOLD);
$p1->value->SetColor("darkred");
$p1->SetSize(0.3);
$p1->SetCenter(0.4);
$p1->SetLegends(array("Jan", "Feb", "Mar", "Apr", "May"));
//$p1->SetStartAngle(M_PI/8);
$p1->ExplodeSlice(3);
$graph->Add($p1);
$graph->Stroke();
?>


コード例 #2
0
ファイル: example27.2.php プロジェクト: Ethennoob/Web
<?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 PiePlot($data);
$p1->ExplodeSlice(1);
$p1->SetCenter(0.45);
$p1->SetLegends($gDateLocale->GetShortMonth());
$graph->Add($p1);
$graph->Stroke();
?>


コード例 #3
0
ファイル: imgcc.php プロジェクト: Nerus87/PsychoStats
        $data[] = 1;
        $labels[] = 'unknown';
    }
}
//$graph = new PieGraph(375, 285, $imgfilename, CACHE_TIMEOUT);
$graph = new PieGraph(imgdef($q['width'], 600), imgdef($q['height'], 300), $imgfilename, CACHE_TIMEOUT);
if (imgdef($q['antialias'], 0)) {
    $graph->SetAntiAliasing();
}
$graph->SetColor(imgdef($q['frame']['margin'], '#d7d7d7'));
$graph->title->Set(imgdef($q['frame']['title']['_content'], 'Breakdown of Countries'));
$graph->title->SetFont(constant(imgdef($q['frame']['title']['font'], 'FF_FONT1')), FS_BOLD);
//$graph->subtitle->Set("(Excludes unknown)");
//$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);
/*
コード例 #4
0
ファイル: Estadistica.php プロジェクト: aeduc/mideteed
 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();
     */
 }
コード例 #5
0
ファイル: page_manager.php プロジェクト: laiello/yt-cache
 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;
 }
コード例 #6
0
ファイル: Grafico.php プロジェクト: aeduc/mideteed
 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();
     */
 }