function graph_pie_chart($graph_title, $graph_theme, $legend_array, $data_array, $xcoord, $ycoord) { //unlink("Images/piecharts2/pie_chart_image.png"); print "{$graph_title}"; print "{$graph_theme}"; print "{$legend_array}"; print "{$data_array}"; print "{$xcoord}"; print "{$ycoord}"; print "{$legend_array['2']}"; $graph = new PieGraph($xcoord, $ycoord); $graph->title->Set($graph_title); $graph->title->SetFont(FF_FONT1, FS_BOLD); $pie = new PiePlot($data_array); $pie->SetLegends($legend_array); $pie->SetTheme($graph_theme); //Sets the colour scheme defined in jpgraph_pie.php $graph->Add($pie); $graph->Stroke("images/piecharts2/pie_chart_image.png"); }
<?php include "../jpgraph.php"; include "../jpgraph_pie.php"; // Some data $data = array(113, 5, 160, 3, 15, 10, 1); // Create the Pie Graph. $graph = new PieGraph(300, 200, "auto"); $graph->SetShadow(); // Set A title for the plot $graph->title->Set("Example 1 Pie plot"); $graph->title->SetFont(FF_VERDANA, FS_BOLD, 14); $graph->title->SetColor("brown"); // Create pie plot $p1 = new PiePlot($data); //$p1->SetSliceColors(array("red","blue","yellow","green")); $p1->SetTheme("earth"); $p1->SetFont(FF_ARIAL, FS_NORMAL, 10); // Set how many pixels each slice should explode $p1->Explode(array(0, 15, 15, 25, 15)); $graph->Add($p1); $graph->Stroke(); ?>
<?php // content="text/plain; charset=utf-8" require_once "jpgraph/jpgraph.php"; require_once "jpgraph/jpgraph_pie.php"; $data = array(40, 60, 21, 33, 12, 33); $graph = new PieGraph(150, 150); $graph->SetShadow(); $graph->title->Set("'pastel' Theme"); $graph->title->SetFont(FF_FONT1, FS_BOLD); $p1 = new PiePlot($data); $p1->SetTheme("pastel"); $p1->SetCenter(0.5, 0.55); $p1->value->Show(false); $graph->Add($p1); $graph->Stroke(); ?>
function JpGraph() { $graph = new PieGraph(230, 200, "auto"); //$graph->SetShadow(); // Set A title for the plot $graph->title->Set($tpl->_ENGINE_parse_body("{your mailbox usage}\n ({$kb} mb free)")); $graph->title->SetFont(FF_FONT1, FS_BOLD, 12); $graph->title->SetColor("black"); $p1 = new PiePlot($data); $p1->SetSliceColors(array("red", "green", "yellow", "green")); $p1->SetTheme("water"); $p1->value->SetFont(FF_FONT1, FS_NORMAL, 10); $p1->Explode(array(0, 15, 15, 25, 15)); //$p1->SetLabelType(PIE_VALUE_PER); //$lbl = array("{used} $USER_STORAGE_USAGE","{free}"); //$p1->SetLabels($lbl); $graph->Add($p1); //$graph->img->SetAntiAliasing(); $graph->Stroke(); }
<?php include "../jpgraph.php"; include "../jpgraph_pie.php"; $data = array(40, 60, 21, 33, 12, 33); $graph = new PieGraph(150, 150, "auto"); $graph->SetShadow(); $graph->title->Set("'sand' Theme"); $graph->title->SetFont(FF_FONT1, FS_BOLD); $p1 = new PiePlot($data); $p1->SetTheme("sand"); $p1->SetCenter(0.5, 0.55); $p1->value->Show(false); $graph->Add($p1); $graph->Stroke(); ?>
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; }
$labels = array(); $data = array(); foreach ($stats as $point) { if ($point["name"] != "Start") { $labels[] = $point["name"] . " (" . $point["diff"] . ")"; $data[] = (double) $point["diff"]; } } // A new graph $graph = new PieGraph(750, 500, "auto"); // Setup title $graph->title->Set("Benchmark Results"); $graph->title->SetFont($font, FS_BOLD, 12); // The pie plot $p1 = new PiePlot($data); $p1->SetTheme('pastel'); // Move center of pie to the left to make better room // for the legend $p1->SetCenter(0.26, 0.55); // Label font and color setup $p1->SetFont($font, FS_BOLD); $p1->SetFontColor("black"); // Use absolute values (type==1) $p1->SetLabelType(1); // Label format $p1->SetLabelFormat("%.5f"); // Size of pie in fraction of the width of the graph $p1->SetSize(0.3); // Legends $p1->SetLegends($labels); $graph->legend->SetFont($font);
<?php include "../jpgraph.php"; include "../jpgraph_pie.php"; $data = array(40, 60, 21, 33, 12, 33); $graph = new PieGraph(150, 150, "auto"); $graph->SetShadow(); $graph->title->Set("'water' Theme"); $graph->title->SetFont(FF_FONT1, FS_BOLD); $p1 = new PiePlot($data); $p1->SetTheme("water"); $p1->SetCenter(0.5, 0.55); $p1->value->Show(false); $graph->Add($p1); $graph->Stroke(); ?>
function baw_render_jpgraph_img() { include_once "../config.php"; if (isset($_GET['type'])) { $type = $_GET['type']; } else { return; } $d = $_GET['d']; $f = $_GET['f']; $count = count($d); $dir = $BAW_CONF['jpgraph_path'] . '/jpgraph.php'; include_once $dir; switch ($type) { case 'bar': include_once $BAW_CONF['jpgraph_path'] . '/jpgraph_bar.php'; break; case 'pie': include_once $BAW_CONF['jpgraph_path'] . "/jpgraph_pie.php"; $size = 0.17; $graph = new PieGraph(600, 250, "auto"); for ($i = 0; $i < 1; $i++) { $p1 = new PiePlot($d[$i]); if ($i == 0) { $p1->SetLegends($d[0]); } $p1->title->Set($f[1]); $p1->SetSize($size); $vert = 0.15 + ($size + 0.1) * $i; $p1->SetCenter($vert, 0.3); $p1->SetStartAngle(0); $p1->SetTheme("sand"); $graph->Add($p1); } $graph->Stroke(); break; case 'line': include_once $BAW_CONF['jpgraph_path'] . "/jpgraph_line.php"; break; } return $out; }
$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); /* 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);
$p2_data = eval("return Array(" . stripslashes($_GET['p2_data']) . ");"); # Create the Pie Graph. $graph = new PieGraph(700, 250); # Set A title for the plot $graph->title->Set($graph_title); $graph->title->SetFont(FF_FONT2, FS_BOLD); # Create $size = 0.25; $p1 = new PiePlot($p1_data); $p1->SetTheme($p1_theme); $p1->SetSize($size); $p1->SetCenter(0.2, 0.6); $p1->SetLegends($legend); $p1->title->Set($p1_title); $p2 = new PiePlot($p2_data); $p2->SetTheme($p2_theme); //Sets the colour scheme defined in jpgraph_pie.php #$p2->SetTheme("pca"); //Sets the colour scheme defined in jpgraph_pie.php $p2->SetSize($size); $p2->SetCenter(0.6, 0.6); $p2->title->Set($p2_title); $graph->legend->Pos(0.01, 0.25, "right", "center"); $graph->Add($p1); $graph->Add($p2); $graph->Stroke(); # ------------------------------------ # $Log: pie_chart_2_image.php,v $ # Revision 1.1.1.1 2005/11/30 23:01:26 gth2 # importing initial version - gth # # ------------------------------------
# # $RCSfile: pie_chart_image.php,v $ $Revision: 1.2 $ # ------------------------------------ include "../jpgraph-1.8/src/jpgraph.php"; include "../jpgraph-1.8/src/jpgraph_pie.php"; $title = $_GET['graph_title']; $theme = $_GET['theme']; $legend = eval("return Array(" . stripslashes($_GET['legend']) . ");"); $data = eval("return Array(" . stripslashes($_GET['data']) . ");"); # Create the Pie Graph. $graph = new PieGraph(380, 200); //$graph->SetShadow(); # Set A title for the plot $graph->title->Set($title); $graph->title->SetFont(FF_FONT1, FS_BOLD); # Create $p1 = new PiePlot($data); $p1->SetLegends($legend); $p1->SetTheme($theme); //Sets the colour scheme defined in jpgraph_pie.php $graph->Add($p1); $graph->Stroke(); # ------------------------------------ # $Log: pie_chart_image.php,v $ # Revision 1.2 2005/12/08 19:40:10 gth2 # updating reports containing calls to jp-graph - gth # # Revision 1.1.1.1 2005/11/30 23:01:26 gth2 # importing initial version - gth # # ------------------------------------
$plots = array_values($data["avg_time_per_issue"]["points"]); $graph_title = "Avg. Time spent per issue (min)"; $labels = array_keys($data["avg_time_per_issue"]["points"]); $y_label = "Minutes"; } $graph_title .= " " . $_REQUEST["start_date"] . " through " . $_REQUEST["end_date"]; if (count($plots) < 1) { Header("Location: ../images/no_data.gif"); exit; } if (@$_REQUEST["type"] == "pie") { // A new graph $graph = new PieGraph(500, 300, "auto"); // The pie plot $plot = new PiePlot($plots); $plot->SetTheme('pastel'); // Move center of pie to the left to make better room // for the legend $plot->SetCenter(0.26, 0.55); // Label font and color setup $plot->SetFont(FF_FONT1, FS_BOLD); $plot->SetFontColor("black"); // Use percentages $plot->SetLabelType(0); // Size of pie in fraction of the width of the graph $plot->SetSize(0.3); // Legends $plot->SetLegends($labels); $graph->legend->SetFont(FF_FONT1); $graph->legend->Pos(0.06, 0.27); } else {
$db = new db(); if ($_GET['kelas'] == '') { exit(0); } //Roti kelas x $kelase = mysql_real_escape_string($_GET['kelas']); while ($i <= $jkel) { $jur = $kelas[$i]; $jum = $db->baris("SELECT * FROM tbl_anggota WHERE jurusan='{$jur}' && kelas like '{$kelase}' && count !='0'"); //echo "$jur = $jum<br>"; array_unshift($droti, $jum); array_unshift($dkel, "{$kelase} " . $jur); $i++; } //print_r($droti); //echo "<br>"; //print_r($dkel); /**/ if (array_sum($droti) == '0') { $droti = array('1'); $dkel = array('Data Masih Kosong'); } $roti = new PieGraph(400, 400); $roti->title->Set("Peminjaman Berdasarkan Kelas (Kelas " . strtoupper($kelase) . ") | Libska"); $irisan = new PiePlot($droti); $irisan->SetTheme('sand'); $roti->Add($irisan); $irisan->SetLegends($dkel); $irisan->ShowBorder(); $roti->Stroke(); /**/