本文整理汇总了PHP中PieGraph::stroke方法的典型用法代码示例。如果您正苦于以下问题:PHP PieGraph::stroke方法的具体用法?PHP PieGraph::stroke怎么用?PHP PieGraph::stroke使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PieGraph
的用法示例。
在下文中一共展示了PieGraph::stroke方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: user_per_group
/**
* Collects and renders user per group report data
*/
public function user_per_group()
{
$myConfig = $this->getConfig();
$oDb = oxDb::getDb();
global $aTitles;
$aDataX = array();
$aDataY = array();
$sSQL = "SELECT oxgroups.oxtitle,\n count(oxuser.oxid)\n FROM oxobject2group,\n oxuser,\n oxgroups\n WHERE oxobject2group.oxobjectid = oxuser.oxid AND\n oxobject2group.oxgroupsid = oxgroups.oxid\n GROUP BY oxobject2group.oxgroupsid\n ORDER BY oxobject2group.oxgroupsid";
$rs = $oDb->execute($sSQL);
if ($rs != false && $rs->recordCount() > 0) {
while (!$rs->EOF) {
if ($rs->fields[1]) {
$aDataX[] = $rs->fields[1];
$aDataY[] = $rs->fields[0];
}
$rs->moveNext();
}
}
header("Content-type: image/png");
// New graph with a drop shadow
if (count($aDataX) > 10) {
$graph = new PieGraph(800, 830);
} else {
$graph = new PieGraph(600, 600);
}
$graph->setBackgroundImage($myConfig->getImageDir(true) . "/reportbgrnd.jpg", BGIMG_FILLFRAME);
$graph->setShadow();
// Set title and subtitle
//$graph->title->set($this->aTitles[$myConfig->getConfigParam( 'iAdminLanguage' ) ]);
$graph->title->set($this->aTitles[oxRegistry::getLang()->getObjectTplLanguage()]);
// Use built in font
$graph->title->setFont(FF_FONT1, FS_BOLD);
// Create the bar plot
$bplot = new PiePlot3D($aDataX);
$bplot->setSize(0.4);
$bplot->setCenter(0.5, 0.32);
// explodes all chunks of Pie from center point
$bplot->explodeAll(10);
$iUserCount = 0;
foreach ($aDataX as $iVal) {
$iUserCount += $iVal;
}
for ($iCtr = 0; $iCtr < count($aDataX); $iCtr++) {
$iSLeng = strlen($aDataY[$iCtr]);
if ($iSLeng > 20) {
if ($iSLeng > 23) {
$aDataY[$iCtr] = trim(substr($aDataY[$iCtr], 0, 20)) . "...";
}
}
$aDataY[$iCtr] .= " - " . $aDataX[$iCtr] . " Kund.";
}
$bplot->setLegends($aDataY);
if (count($aDataX) > 10) {
$graph->legend->pos(0.49, 0.66, 'center');
$graph->legend->setFont(FF_FONT0, FS_NORMAL);
$graph->legend->setColumns(4);
} else {
$graph->legend->pos(0.49, 0.7, 'center');
$graph->legend->setFont(FF_FONT1, FS_NORMAL);
$graph->legend->setColumns(2);
}
$graph->add($bplot);
// Finally output the image
$graph->stroke();
}
示例2: 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);
//.........这里部分代码省略.........