Exemplo n.º 1
0
require_once 'jpgraph/jpgraph.php';
require_once 'jpgraph/jpgraph_pie.php';
require_once 'jpgraph/jpgraph_pie3d.php';
//$gJpgBrandTiming=true;
// Some data
$data = array(40, 21, 17, 27, 23);
// Create the Pie Graph.
$graph = new PieGraph(400, 200, 'auto');
$graph->SetShadow();
// Set A title for the plot
$graph->title->Set("3D Pie Client side image map");
$graph->title->SetFont(FF_FONT1, FS_BOLD);
// Create
$p1 = new PiePlot3D($data);
$p1->SetLegends(array("Jan (%d)", "Feb", "Mar", "Apr", "May", "Jun", "Jul"));
$targ = array("pie3d_csimex1.php?v=1", "pie3d_csimex1.php?v=2", "pie3d_csimex1.php?v=3", "pie3d_csimex1.php?v=4", "pie3d_csimex1.php?v=5", "pie3d_csimex1.php?v=6");
$alts = array("val=%d", "val=%d", "val=%d", "val=%d", "val=%d", "val=%d");
$p1->SetCSIMTargets($targ, $alts);
// Use absolute labels
$p1->SetLabelType(1);
$p1->value->SetFormat("%d kr");
// Move the pie slightly to the left
$p1->SetCenter(0.4, 0.5);
$graph->Add($p1);
// Send back the HTML page which will call this script again
// to retrieve the image.
$graph->StrokeCSIM();
?>


Exemplo n.º 2
0
    $data[$i] = $row["SUM({$category})"];
    $i++;
}
// TESTS
//for ($i=0; $i < sizeof($users) ; $i++) {
//echo"<p>$users[$i]</p>";
//}
//for ($i=0; $i < sizeof($data) ; $i++) {
//	echo"<p>$data[$i]</p>";
//}
// Create the Pie Graph.
$graph = new PieGraph(300, 300);
$theme_class = new UniversalTheme();
$graph->SetTheme($theme_class);
// Set A title for the plot
$graph->title->Set("Breakdown of {$category}");
// Create
$p1 = new PiePlot3D($data);
$p1->SetLegends($users);
$p1->SetCenter(0.5, 0.4);
$p1->SetSize(0.5);
$p1->SetLabelType(PIE_VALUE_PER);
$p1->value->show();
$p1->value->SetFont(FF_FONT0, FS_NORMAL, 12);
//$graph->SetMarginColor('khaki:0.6');
//$graph->SetFrame(true,'khaki:0.2',1);
$graph->Add($p1);
$p1->ShowBorder();
//$p1->SetColor('black');
//$p1->ExplodeSlice(1);
$graph->Stroke();
Exemplo n.º 3
0
$resultadoDos = mysqli_query($conexion, "select count(*) cantidad2 from disparo where factor=0");
while ($row = mysqli_fetch_array($resultadoDos)) {
    $dato2 = $row["cantidad2"];
}
mysqli_close($conexion);
$data = array($dato1, $dato2);
$a = array('reales', 'falsas');
$ancho = 600;
$alto = 250;
//crear la instancia del objeto graph
$graph = new PieGraph($ancho, $alto, 'auto');
$graph->img->SetAntiAliasing();
// $graph->SetMarginColor('gray');
$graph->title->Set("Alarmas disparadas reales/falsas");
$graph->title->SetFont(FF_ARIAL, FS_BOLD, 14);
$p1 = new PiePlot3D($data);
$p1->SetLegends($a);
$p1->SetSize(0.45);
$p1->SetCenter(0.5);
$p1->SetLabelType(PIE_VALUE_ADJPERCENTAGE);
$graph->legend->SetAbsPos(220, 220, 50, 10);
$graph->title->SetMargin(20, 50, 50, 100);
$p1->value->SetFont(FF_FONT1, FS_BOLD);
$p1->value->SetColor("black");
$p1->SetLabelPos(0.5);
$graph->Add($p1);
$graph->Stroke();
?>


 // Show 0 label on Y-axis (default is not to show)
 $graph->yscale->ticks->SupressZeroLabel(false);
 // Set Fonts for graph!
 $graph->xaxis->SetFont(FF_VERA, FS_NORMAL, 8);
 $graph->yaxis->SetFont(FF_VERA, FS_NORMAL, 8);
 $graph->legend->SetFont(FF_VERA, FS_NORMAL, 8);
 // Create
 $p1 = new PiePlot3D($YchartData);
 $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);
Exemplo n.º 5
0
 function generatePie3D($data, $legend_index = 0, $chartData_index = 1, $image = false, $length = 500, $width = 300, $hasShadow = true, $fontFamily = FF_FONT1, $fontStyle = FS_BOLD, $fontSize = '', $fontColor = 'black')
 {
     include_once XHELP_JPGRAPH_PATH . '/jpgraph_pie.php';
     include_once XHELP_JPGRAPH_PATH . '/jpgraph_pie3d.php';
     $graph = new PieGraph($length, $width);
     if ($hasShadow) {
         // Add a shadow to the image
         $graph->setShadow();
     }
     $graph->title->Set($this->meta['name']);
     $p1 = new PiePlot3D($data[$chartData_index]);
     $p1->SetSize(0.3);
     $p1->SetCenter(0.45);
     $p1->SetStartAngle(20);
     $p1->SetAngle(45);
     $p1->SetLegends($data[$legend_index]);
     $p1->value->SetFont($fontFamily, $fontStyle, $fontSize);
     $p1->value->SetColor($fontColor);
     $p1->SetLabelType(PIE_VALUE_PER);
     $a = array_search(max($data[$chartData_index]), $data[$chartData_index]);
     //Find the position of maximum value.
     $p1->ExplodeSlice($a);
     // Set graph background image
     if ($image != false) {
         $graph->SetBackgroundImage($image, BGIMG_FILLFRAME);
     }
     $graph->Add($p1);
     $graph->Stroke();
 }