本文整理汇总了PHP中PiePlot::SetCenter方法的典型用法代码示例。如果您正苦于以下问题:PHP PiePlot::SetCenter方法的具体用法?PHP PiePlot::SetCenter怎么用?PHP PiePlot::SetCenter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PiePlot
的用法示例。
在下文中一共展示了PiePlot::SetCenter方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createPlot
public function createPlot()
{
$size = '0.25';
$plot = new \PiePlot($this->data);
$plot->SetLegends($this->legends);
$plot->SetSize($size);
$plot->SetCenter(0.25, 0.32);
$plot->ShowBorder();
$plot->SetColor('black');
$this->grafico->add($plot);
}
示例2: addSinglePlot
public function addSinglePlot($data, $x = 0.5, $y = 0.5, $title = null)
{
$plot = new PiePlot(array_values($data));
$plot->SetSize($this->plot_size);
$plot->SetCenter($x, $y);
$plot->setLabelPos(0.6);
//$plot->setLegends(array_keys($data));
if ($title != null) {
$plot->title->set($title);
}
$this->grapher->Add($plot);
}
示例3: plot
function plot()
{
$this->_setValues();
// Create the Pie Graph.
$graph = new PieGraph(500, 300);
$graph->SetShadow();
// Create
$p1 = new PiePlot($this->_data);
// Set A title for the plot
$p1->SetLegends($this->_legends);
$p1->SetSize(0.3);
$p1->SetCenter(0.28, 0.5);
$txt = new Text("Most Visited Titles", 0.15, 0.05);
$txt->SetFont(FONT1_BOLD);
$graph->Add($p1);
$graph->AddText($txt);
$graph->Stroke();
}
示例4: buildGraph
/**
* Builds pie graph
*/
function buildGraph()
{
$this->graph = new Chart_Pie($this->width, $this->height);
// title setup
$this->graph->title->Set($this->title);
if (is_null($this->description)) {
$this->description = "";
}
$this->graph->subtitle->Set($this->description);
if (is_array($this->data) && array_sum($this->data) > 0) {
$p = new PiePlot($this->data);
$p->setSliceColors($this->graph->getThemedColors());
$p->SetCenter(0.4, 0.6);
$p->SetLegends($this->legend);
$p->value->HideZero();
$p->value->SetFont($this->graph->getFont(), FS_NORMAL, 8);
$p->value->SetColor($this->graph->getMainColor());
$p->value->SetMargin(0);
$this->graph->Add($p);
}
return $this->graph;
}
示例5: executePieGraph
public function executePieGraph()
{
//Set the response header to a image JPEG datastream
$this->getResponse()->setContent('image/jpeg');
$util = new util();
//echo $duales;
$data1 = $util->getDualMedia('movies');
$data2 = $util->getTotalMedia('movies') - $data1;
$data = array($data2, $data1);
$graph = new PieGraph(199, 120);
$graph->SetMarginColor('#393939');
$graph->SetFrame(true, '#393939');
$graph->legend->SetPos(0.8, 0.9, 'center', 'bottom');
$p1 = new PiePlot($data);
$p1->SetSize(0.4);
$p1->SetCenter(0.45);
$p1->SetSliceColors(array('white', 'red'));
$p1->value->SetColor('black');
$p1->SetLegends(array("Spa", "Dual"));
$p1->SetLabelPos(0.6);
$graph->Add($p1);
$graph->Stroke();
return sfView::NONE;
}
示例6: PieGraph
}
$jpgraph = $conf->get_conf("jpgraph_path");
require_once "{$jpgraph}/jpgraph.php";
require_once "{$jpgraph}/jpgraph_pie.php";
// Setup graph
$graph = new PieGraph(400, 400, "auto");
$graph->SetAntiAliasing();
$graph->SetMarginColor('#fafafa');
//$graph->SetShadow();
$graph->title->SetFont(FF_FONT1, FS_BOLD);
// Create pie plot
$p1 = new PiePlot($data);
//$p1->SetHeight(12);
$p1->SetSize(0.3);
if (count($labels) > 1) {
$p1->SetCenter(0.5, 0.5);
} else {
$p1->SetCenter(0.57, 0.3);
}
$p1->SetLabels($labels);
$p1->SetLabelPos(1);
if ($multiple_colors) {
$p1->SetLegends($legend);
$graph->legend->SetPos(0.5, 0.95, 'center', 'bottom');
$graph->legend->SetFrameWeight(0);
$graph->legend->SetFillColor('#fafafa');
$graph->legend->SetShadow(FALSE);
}
$graph->SetFrame(false);
$p1->SetSliceColors($colors);
//$p1->SetStartAngle(M_PI/8);
示例7: print_graph
//.........这里部分代码省略.........
// 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);
} else {
$p1->SetLabelType(PIE_VALUE_ABS);
}
if ($percent || $show_percent) {
$p1->value->SetFormat("%d%%");
} else {
$p1->value->SetFormat("%s");
}
} else {
$p1->value->Show(false);
}
$p1->SetLegends($legends);
$p1->SetEdge();
$p1->SetSize($psize);
$p1->SetCenter($pposx, $pposy);
if ($labels[0]) {
$graph->subtitle->Set($labels[0]);
示例8: PieGraph
$skip_count = $request->get('s');
$total_count = $pass_count + $fail_count + $skip_count;
// graph size
$graph = new PieGraph(250, 150);
// graph title
$graph->title->Set($GLOBALS['Language']->getText('plugin_hudson', 'project_job_testresults'));
// graph legend
$pass_legend = $GLOBALS['Language']->getText('plugin_hudson', 'pass_legend', array($pass_count));
$fail_legend = $GLOBALS['Language']->getText('plugin_hudson', 'fail_legend', array($fail_count));
$skip_legend = $GLOBALS['Language']->getText('plugin_hudson', 'skip_legend', array($skip_count));
$array_legend = array($pass_legend, $fail_legend);
$array_value = array($pass_count, $fail_count);
$array_color = array('blue', 'red');
if ($skip_count != 0) {
$array_legend[] = $skip_legend;
$array_value[] = $skip_count;
$array_color[] = 'black';
}
// Init pie chart with graph values
$pp = new PiePlot($array_value);
// pie chart legend
$pp->SetLegends($array_legend);
// pie chart color values
// Pass is blue and Failed is red (Skip is black)
$pp->SetSliceColors($array_color);
// pie chart position
// the pie chart is a little bit on the left (0.35) and at the bottom (0.60)
$pp->SetCenter(0.35, 0.6);
$graph->Add($pp);
// display graph
$graph->Stroke();
示例9: _getTorta
private function _getTorta($datos, $textos)
{
//Se define el grafico
$grafico = new PieGraph(450, 300);
//Definimos el titulo
$grafico->title->Set("Mi primer grafico de tarta");
$grafico->title->SetFont(FF_FONT1, FS_BOLD);
//Añadimos el titulo y la leyenda
$p1 = new PiePlot($datos);
$p1->SetLegends($textos);
$p1->SetCenter(0.4);
//Se muestra el grafico
$grafico->Add($p1);
$grafico->Stroke();
}
示例10: 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);
//.........这里部分代码省略.........
示例11: main
//.........这里部分代码省略.........
# $p1 = new PiePlot(array_values($data));
# $p1->SetLegends(array_keys($data));
# $p1->SetCenter(0.4);
# $graph->Add($p1);
# array_push($graphs, $graph);
/*
CAS distribution
*/
# $query = "SELECT SUM(bh) AS 'bh', SUM(si) AS 'si', SUM(ki) AS 'ki' FROM match_data";
# $result = mysql_query($query);
# $o = (object) mysql_fetch_assoc($result);
# $data = array("BH ($o->bh)" => $o->bh, "SI ($o->si)" => $o->si, "Ki ($o->ki)" => $o->ki);
# $graph = new PieGraph($opts['xdim'],$opts['ydim'],"auto");
# $graph->SetShadow();
# $graph->title->Set('Current CAS distribution');
# $graph->title->SetFont(FF_FONT1,FS_BOLD);
# $p1 = new PiePlot(array_values($data));
# $p1->SetLegends(array_keys($data));
# $p1->SetCenter(0.4);
# $graph->Add($p1);
# array_push($graphs, $graph);
} else {
/********************
* Current CAS
********************/
if (!$cmp_id && $o->mv_cas != 0) {
$data = array("BH ({$o->mv_bh})" => $o->mv_bh, "SI ({$o->mv_si})" => $o->mv_si, "Ki ({$o->mv_ki})" => $o->mv_ki);
$graph = new PieGraph($opts['xdim'], $opts['ydim'], "auto");
$graph->SetShadow();
$graph->title->Set('Current CAS distribution');
$graph->title->SetFont(FF_FONT1, FS_BOLD);
$p1 = new PiePlot(array_values($data));
$p1->SetLegends(array_keys($data));
$p1->SetCenter(0.4);
$graph->Add($p1);
array_push($graphs, $graph);
}
/********************
* BH, SI and Ki
********************/
$queries = array();
foreach (range(0, SG_MULTIBAR_HIST_LENGTH) as $i) {
$range = "(\n (YEAR(date_played) = YEAR(SUBDATE(DATE(NOW()), INTERVAL {$i} MONTH)))\n AND\n (MONTH(date_played) = MONTH(SUBDATE(DATE(NOW()), INTERVAL {$i} MONTH)))\n )";
# m$i = minus/negative $i months from present month.
array_push($queries, "SUM(IF({$range}, bh, 0)) AS 'BH_m{$i}'");
array_push($queries, "SUM(IF({$range}, si, 0)) AS 'SI_m{$i}'");
array_push($queries, "SUM(IF({$range}, ki, 0)) AS 'Ki_m{$i}'");
array_push($queries, "YEAR(SUBDATE(DATE(NOW()), INTERVAL {$i} MONTH)) AS 'yr_m{$i}'");
array_push($queries, "MONTH(SUBDATE(DATE(NOW()), INTERVAL {$i} MONTH)) AS 'mn_m{$i}'");
}
$query = "SELECT " . implode(', ', $queries) . " FROM matches, match_data WHERE f_match_id = match_id AND {$where}";
$result = mysql_query($query);
$row = mysql_fetch_assoc($result);
$lengends = array('BH' => 'forestgreen', 'SI' => 'firebrick', 'Ki' => 'blue');
list($datasets, $labels) = SGraph::mbarsInputFormatter($lengends, $row);
array_push($graphs, SGraph::mbars($datasets, $labels, $lengends, "BH, SI and Ki distribution history", "Months", "Amount", $opts));
/********************
* CP & TD
********************/
$queries = array();
foreach (range(0, SG_MULTIBAR_HIST_LENGTH) as $i) {
$range = "(\n (YEAR(date_played) = YEAR(SUBDATE(DATE(NOW()), INTERVAL {$i} MONTH)))\n AND\n (MONTH(date_played) = MONTH(SUBDATE(DATE(NOW()), INTERVAL {$i} MONTH)))\n )";
# m$i = minus/negative $i months from present month.
array_push($queries, "SUM(IF({$range}, cp, 0)) AS 'CP_m{$i}'");
array_push($queries, "SUM(IF({$range}, td, 0)) AS 'TD_m{$i}'");
# array_push($queries, "SUM(IF($range, intcpt, 0)) AS 'int_m$i'");
示例12: stripslashes
<?php
date_default_timezone_set('America/Bogota');
require_once "lib/jpgraph/src/jpgraph.php";
require_once "lib/jpgraph/src/jpgraph_pie.php";
// Se define el array de valores y el array de la leyenda
if (isset($_GET['datos']) && isset($_GET['textos'])) {
$d = stripslashes($_GET['datos']);
$datos = unserialize($d);
$t = stripslashes($_GET['textos']);
$textos = unserialize($t);
//$titulo = $_GET['titulo'];
//Se define el grafico
$grafico = new PieGraph(380, 200);
//Definimos el titulo
$grafico->title->Set("Grafica");
$grafico->title->SetFont(FF_FONT1, FS_BOLD);
//Aâ±adimos el titulo y la leyenda
$p1 = new PiePlot($datos);
$p1->SetLegends($textos);
$p1->SetCenter(0.2);
//Se muestra el grafico
$grafico->Add($p1);
$grafico->Stroke();
}
示例13: PiePlot
$p1 = new PiePlot($data);
$p1->SetLegends(array("Jan", "Feb", "Mar", "Apr", "May"));
$p1->SetSize($size);
$p1->SetCenter(0.25, 0.32);
$p1->value->SetFont(FF_FONT0);
$p1->title->Set("2001");
$p2 = new PiePlot($data);
$p2->SetSize($size);
$p2->SetCenter(0.65, 0.32);
$p2->value->SetFont(FF_FONT0);
$p2->title->Set("2002");
$p3 = new PiePlot($data);
$p3->SetSize($size);
$p3->SetCenter(0.25, 0.75);
$p3->value->SetFont(FF_FONT0);
$p3->title->Set("2003");
$p4 = new PiePlot($data);
$p4->SetSize($size);
$p4->SetCenter(0.65, 0.75);
$p4->value->SetFont(FF_FONT0);
$p4->title->Set("2004");
$graph->Add($p1);
$graph->Add($p2);
$graph->Add($p3);
$graph->Add($p4);
$graph->Stroke();
?>
示例14: createCookieGraph
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;
}
示例15: 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);
}