当前位置: 首页>>代码示例>>PHP>>正文


PHP PiePlot::SetLabelType方法代码示例

本文整理汇总了PHP中PiePlot::SetLabelType方法的典型用法代码示例。如果您正苦于以下问题:PHP PiePlot::SetLabelType方法的具体用法?PHP PiePlot::SetLabelType怎么用?PHP PiePlot::SetLabelType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PiePlot的用法示例。


在下文中一共展示了PiePlot::SetLabelType方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: array

// content="text/plain; charset=utf-8"
require_once 'jpgraph/jpgraph.php';
require_once 'jpgraph/jpgraph_pie.php';
$data = array(19, 12, 4, 3, 3, 12, 3, 3, 5, 6, 7, 8, 8, 1, 7, 2, 2, 4, 6, 8, 21, 23, 2, 2, 12);
// Create the Pie Graph.
$graph = new PieGraph(300, 350);
// Set A title for the plot
$graph->title->Set("Label guide lines");
$graph->title->SetFont(FF_VERDANA, FS_BOLD, 12);
$graph->title->SetColor("darkblue");
$graph->legend->Pos(0.1, 0.2);
// Create pie plot
$p1 = new PiePlot($data);
$p1->SetCenter(0.5, 0.55);
$p1->SetSize(0.3);
// Enable and set policy for guide-lines
$p1->SetGuideLines();
$p1->SetGuideLinesAdjust(1.4);
// Setup the labels
$p1->SetLabelType(PIE_VALUE_PER);
$p1->value->Show();
$p1->value->SetFont(FF_ARIAL, FS_NORMAL, 9);
$p1->value->SetFormat('%2.1f%%');
// Add and stroke
$graph->Add($p1);
$graph->Stroke();
?>


开发者ID:hcvcastro,项目名称:pxp,代码行数:27,代码来源:pielabelsex1.php

示例2: print_graph


//.........这里部分代码省略.........
                        if ($longestlabel && !$overlap) {
                            // if legend showing
                            $pmr = $longestlabel * 5 + 40;
                        }
                        $graph->legend->Pos(0.02, 0.1, 'right', 'top');
                    } else {
                        if ($type == 'horiz_bar') {
                            $pml = 50;
                            $pmr = 20;
                            $pmt = 50;
                            $pmb = 45;
                            $ll = $longestlegend * 6.5;
                            // 8pt fontsize
                            $pml = max($pml, $ll + 20);
                            $xaxislblmargin = $pml - 20;
                            $yaxislblmargin = $pmb - 15;
                            if ($longestlabel && !$overlap) {
                                // if legend showing
                                $pmr = $longestlabel * 5 + 40;
                            }
                            $graph->legend->Pos(0.02, 0.1, 'right', 'top');
                        }
                    }
                }
            }
        }
        // DRAW THE GRAPHS
        if ($type == 'pie') {
            $p1 = new PiePlot($data[0]);
            $p1->SetSliceColors($colours);
            if ($show_values) {
                $p1->value->SetFont(FF_USERFONT, FS_NORMAL, 8 * $k);
                if ($percent) {
                    $p1->SetLabelType(PIE_VALUE_PERADJ);
                } else {
                    $p1->SetLabelType(PIE_VALUE_ABS);
                }
                if ($percent || $show_percent) {
                    $p1->value->SetFormat("%d%%");
                } else {
                    $p1->value->SetFormat("%s");
                }
                // Enable and set policy for guide-lines. Make labels line up vertically
                $p1->SetGuideLines(true);
                $p1->SetGuideLinesAdjust(1.5);
            } else {
                $p1->value->Show(false);
            }
            $p1->SetLegends($legends);
            $p1->SetSize($psize);
            $p1->SetCenter($pposx, $pposy);
            if ($labels[0]) {
                $graph->subtitle->Set($labels[0]);
                $graph->subtitle->SetMargin(10 * $k);
                $graph->subtitle->SetFont(FF_USERFONT, FS_BOLD, 11 * $k);
                $graph->subtitle->SetColor("black");
            }
            $graph->Add($p1);
        } else {
            if ($type == 'pie3d') {
                $p1 = new PiePlot3d($data[0]);
                $p1->SetSliceColors($colours);
                if ($show_values) {
                    $p1->value->SetFont(FF_USERFONT, FS_NORMAL, 8 * $k);
                    if ($percent) {
                        $p1->SetLabelType(PIE_VALUE_PERADJ);
开发者ID:BozzaCoon,项目名称:SPHERE-Framework,代码行数:67,代码来源:graph.php

示例3: PieGraph

 mysql_free_result($rsCSF);
 mysql_free_result($rsCSNF);
 mysql_free_result($rsCSC);
 /// A new pie graph
 $graph = new PieGraph(400, 200, "auto");
 $graph->SetScale('textint');
 $logtype = tr("by_logtype");
 // Title setup
 $graph->title->Set($logtype);
 $graph->title->SetFont(FF_ARIAL, FS_NORMAL);
 //$graph ->legend->Pos( 0.25,0.8,"right" ,"bottom");
 // Setup the pie plot
 $p1 = new PiePlot($y);
 $p1->SetTheme("earth");
 $p1->value->SetFormat("%d");
 $p1->SetLabelType(PIE_VALUE_ABS);
 $p1->SetSliceColors(array('chartreuse3', 'chocolate2', 'wheat1'));
 // Adjust size and position of plot
 $p1->SetSize(0.35);
 $p1->SetCenter(0.25, 0.52);
 $f = tr("found");
 $dnf = tr("not_found");
 $com = tr("comment");
 // Setup slice labels and move them into the plot
 $xx = array($f, $dnf, $com);
 $p1->value->SetFont(FF_COURIER, FS_NORMAL);
 $p1->value->SetColor("black");
 $p1->SetLabelPos(0.65);
 $p1->SetLegends($xx);
 $graph->legend->SetFont(FF_ARIAL, FS_NORMAL);
 // Explode all slices
开发者ID:pawelzielak,项目名称:opencaching-pl,代码行数:31,代码来源:PieGraphcstat.php

示例4: parse

 function parse($input, $parser)
 {
     global $jpgraphLabelType;
     foreach (split("\n", $input) as $line) {
         // skip empty line or comments
         if (preg_match("/^(\\s*)#.*\$|^(\\s*)\$/", $line)) {
             continue;
         }
         // Storing data
         $raw_data = split($this->fieldsep, $line);
         if (count($raw_data) == 2) {
             $this->labels[] = $raw_data[0];
             $this->datay[] = $raw_data[1];
         } else {
             $this->datay[] = $raw_data[0];
         }
     }
     if ($this->is3d) {
         $pie = new PiePlot3D($this->datay);
         $pie->SetAngle($this->angle);
     } else {
         $pie = new PiePlot($this->datay);
     }
     if ($this->center) {
         $tmp = split(",", $this->center);
         if (is_array($tmp) && count($tmp) == 2) {
             $pie->SetCenter($tmp[0], $tmp[1]);
         } else {
             if (is_array($tmp) && count($tmp) == 1) {
                 $pie->SetCenter($tmp[0]);
             }
         }
     }
     if ($this->labeltype) {
         $label_type = $jpgraphLabelType[$this->labeltype];
         if (!$label_type) {
             throw new JpgraphMWException("Unknown label type(" . $this->labeltype . "). Possible values are: " . implode(", ", array_keys($jpgraphLabelType)));
         }
         $pie->SetLabelType($label_type);
     }
     if ($this->labelformat) {
         $pie->value->SetFormat($this->labelformat);
     }
     if ($this->usettf) {
         $pie->value->SetFont($this->font);
     }
     $pie->value->Show($this->showlabel);
     $explode_pie_list = split(",", $this->explode);
     if (count($explode_pie_list) == 1) {
         $pie->ExplodeAll($explode_pie_list[0]);
     } else {
         $pie->Explode($explode_pie_list);
     }
     if (count($this->labels) == count($this->datay)) {
         $pie->SetLegends($this->labels);
     }
     $this->graph->Add($pie);
 }
开发者ID:mediawiki-extensions,项目名称:jpgraphmw,代码行数:58,代码来源:jpgraphmw.php

示例5: PieGraph

    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);
$graph->legend->Pos(0.06, 0.1);
$graph->Add($p1);
$graph->Stroke();
开发者ID:juliogallardo1326,项目名称:proc,代码行数:31,代码来源:benchmark.php

示例6: grafico_distribucion_tipo_resp

 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();
     */
 }
开发者ID:aeduc,项目名称:mideteed,代码行数:35,代码来源:Estadistica.php

示例7: generateLog

 public function generateLog($winner = false)
 {
     $gameid = strtotime('now');
     $template = file_get_contents('data/log.html');
     $fp = fopen(sprintf('logs/log_%d.html', $gameid), 'a');
     $htplayers = array();
     foreach ($this->players as $pl) {
         $htplayers[] = sprintf('<li>%s</li>', htmlspecialchars(parent::playerName($pl)));
     }
     $players = implode("\n", $htplayers);
     if ($winner) {
         $data = sprintf("After %d hands played, the player <strong>%s</strong> won the total pot of <strong>\$%0.2f</strong>", $this->game, parent::playerName($winner), $winner->money);
     } else {
         $htplayers = array();
         foreach ($this->players as $pl) {
             $htplayers[] = sprintf('<li>%s ($%0.2f)</li>', htmlspecialchars(parent::playerName($pl)), $pl->money);
         }
         $htplayers = implode("\n", $htplayers);
         $data = sprintf("After %d hands no winner was determined a summary of each individual player's money follows:<ol>%s</ol>", $this->game, $htplayers);
     }
     $template = str_replace("{players}", $players, $template);
     $template = str_replace("{gameid}", $gameid, $template);
     $template = str_replace("{winner}", $data, $template);
     $template = str_replace("{version}", parent::$version, $template);
     $template = str_replace("{date}", date('d-m-Y h:i', $gameid), $template);
     $template = str_replace("{startmoney}", sprintf('%0.2f', $this->playermoney), $template);
     $template = str_replace("{bigblind}", sprintf('%0.2f', $this->bigblind), $template);
     $template = str_replace("{smallblind}", sprintf('%0.2f', $this->smallblind), $template);
     $template = str_replace("{maxgames}", $this->totalgames, $template);
     $template = str_replace("{winner}", $data, $template, $template);
     fputs($fp, $template);
     fclose($fp);
     require_once 'data/jpgraph.php';
     require_once 'data/jpgraph_line.php';
     $width = 900;
     $height = 300;
     $graph = new Graph($width, $height);
     $graph->img->SetMargin(40, 40, 40, 40);
     $graph->SetShadow();
     $graph->setScale('intlin');
     $graph->title->Set('Amount of money per player, per hand');
     $graph->xaxis->title->Set('Hand');
     $graph->yaxis->title->Set('Money');
     foreach ($this->moneylog as $id => $data) {
         $p = $this->players[$id];
         $lineplot = new LinePlot($data);
         $lineplot->setweight($id);
         $lineplot->SetLegend(parent::playerName($p));
         $graph->add($lineplot);
     }
     $graph->stroke(sprintf('logs/playermoney_%d.jpg', $gameid));
     // Pie graph, showing checks, folds, bets, wins, calls and raises
     require_once "data/jpgraph_pie.php";
     // Create the Pie Graph.
     $height = ceil(count($this->players) / 2) * 440;
     $graph = new PieGraph($width, $height);
     $graph->SetShadow();
     // Set A title for the plot
     $graph->title->Set("Moves per user");
     // Create plots
     $size = 0.2;
     $x = array(0.25, 0.75);
     $y = 220;
     $i = 1;
     $legend = array("Check", "Call", "Bet", "Raise", "Fold");
     foreach ($this->players as $id => $player) {
         $plot = new PiePlot(array($player->checks, $player->calls, $player->bets, $player->raises, $player->folds));
         if ($player->id == 1) {
             $plot->SetLegends($legend);
         }
         $plot->SetLabelType(PIE_VALUE_ADJPERCENTAGE);
         $plot->SetSize($size);
         $plot->SetCenter($x[$i - 1], $y);
         if ($i == 2) {
             $i = 0;
             $y += 420;
         }
         $i++;
         $plot->title->Set(parent::playerName($player));
         $graph->add($plot);
     }
     $graph->stroke(sprintf('logs/playermoves_%d.jpg', $gameid));
     // Bargraph containing each player's wins
     $height = 70 * count($this->players);
     require_once "data/jpgraph_bar.php";
     $graph = new Graph($width, $height);
     $graph->SetScale('textlin');
     $graph->SetShadow();
     $lbl = array();
     $data = array();
     foreach ($this->players as $pl) {
         $lbl[] = parent::PlayerName($pl);
         $data[] = $pl->wins;
     }
     $top = 60;
     $bottom = 30;
     $left = 80;
     $right = 30;
     $graph->Set90AndMargin($left, $right, $top, $bottom);
     $graph->xaxis->SetTickLabels($lbl);
//.........这里部分代码省略.........
开发者ID:helmet,项目名称:Aiserver2,代码行数:101,代码来源:holdem.php

示例8: create_graph

 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;
//.........这里部分代码省略.........
开发者ID:laiello,项目名称:yt-cache,代码行数:101,代码来源:page_manager.php

示例9: PieGraph

    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 {
    // bar chart
    $plot = new BarPlot($plots);
    $plot->showValue(true);
    $plot->SetValueFont(FF_FONT2, FS_NORMAL, 9);
    //$plot->setLegend("Issues");
    // figure out the best size for this graph.
    $width = 75;
    if (count($labels) > 3) {
开发者ID:juliogallardo1326,项目名称:proc,代码行数:31,代码来源:workload_date_range_graph.php

示例10: grafico_3_bd

 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();
     */
 }
开发者ID:aeduc,项目名称:mideteed,代码行数:30,代码来源:Grafico.php


注:本文中的PiePlot::SetLabelType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。