本文整理汇总了PHP中PieGraph::SetShadow方法的典型用法代码示例。如果您正苦于以下问题:PHP PieGraph::SetShadow方法的具体用法?PHP PieGraph::SetShadow怎么用?PHP PieGraph::SetShadow使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PieGraph
的用法示例。
在下文中一共展示了PieGraph::SetShadow方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
/**
* Runs the phpOpenTracker API call.
*
* @param array $parameters
* @return mixed
* @access public
*/
function run($parameters)
{
global $locale;
$parameters['api_call'] = 'localizer';
$parameters['what'] = 'top_localizer';
$parameters['result_format'] = 'separate_result_arrays';
list($names, $values, $percent, $total) = phpOpenTracker::get($parameters);
$title = $locale->get('admin_stat', 'field_top') . ' ' . $parameters['limit'] . ' ' . $locale->get('admin_stat', 'field_countries');
for ($i = 0, $numValues = sizeof($values); $i < $numValues; $i++) {
$legend[$i] = sprintf('%s (%s, %s%%%%)', $names[$i], $values[$i], $percent[$i]);
}
$graph = new PieGraph($parameters['width'], $parameters['height'], 'auto');
$graph->SetShadow();
$graph->title->Set($title);
$graph->title->SetFont($parameters['font'], $parameters['font_style'], $parameters['font_size']);
$graph->title->SetColor('black');
$graph->legend->Pos(0.1, 0.2);
$plot = new PiePlot3d($values);
$plot->SetTheme('sand');
$plot->SetCenter(0.4);
$plot->SetAngle(30);
$plot->value->SetFont($parameters['font'], $parameters['font_style'], $parameters['font_size'] - 2);
$plot->SetLegends($legend);
$graph->Add($plot);
$graph->Stroke();
}
示例2: pieChart
public static function pieChart($data, $legends)
{
$graph = new PieGraph(900, 550, 'auto');
$graph->SetShadow();
// $graph->title->Set($topic);
$graph->title->SetFont(FF_VERDANA, FS_BOLD, 14);
$graph->legend->Pos(0.1, 0.2);
// Creating a 3D pie graphic
$p1 = new PiePlot3d($data);
$p1->SetTheme("sand");
$p1->SetLabels($legends);
$p1->SetLabelPos(1);
$p1->SetLabelType(PIE_VALUE_PER);
$p1->value->Show();
$p1->value->SetFont(FF_ARIAL, FS_NORMAL, 20);
$p1->value->SetColor('darkgray');
$p1->SetCenter(0.45, 0.5);
$p1->SetAngle(45);
$p1->ExplodeAll(20);
// $p1->value->SetFont(FF_ARIAL, FS_NORMAL, 12);
// $p1->SetLegends($legends);
$graph->img->SetImgFormat('png');
$graph->Add($p1);
// Showing graphic
return $graph->Stroke('../graph/3DpieChart.png');
}
示例3: PieGraph
function create_pie_graph()
{
$graph = new PieGraph($this->width, $this->height, "auto");
//instantiate new PieGraph object
$graph->SetShadow();
//displayed with shadow
$graph->title->Set($this->title);
//setup graph title
$graph->title->SetFont(FF_VERDANA, FS_BOLD, 10);
//set up font porperties
$graph->title->SetColor("darkblue");
$p1 = new PiePlot3D($this->data);
//define new 3D image for PieGraph
$p1->ExplodeAll();
//explode each sector of the pie
$p1->SetTheme("sand");
//set up the theme (Colors)
$p1->SetCenter(0.45);
//display on center
$p1->SetLegends($this->label);
//set up legend of the graph
//$p1->SetLabel($this->label); //set up the labels of each sector of the pie graph
// Setup the slice values
$p1->value->SetFont(FF_ARIAL, FS_BOLD, 11);
$p1->value->SetColor("navy");
$graph->Add($p1);
//add 3D pie to PieGraph object
$graph->Stroke();
//display grapg
}
示例4: run
/**
* Runs the phpOpenTracker API call.
*
* @param array $parameters
* @return mixed
* @access public
*/
function run($parameters)
{
$parameters['api_call'] = 'top';
$parameters['result_format'] = 'separate_result_arrays';
list($names, $values, $percent, $total) = phpOpenTracker::get($parameters);
$title = 'Top ' . $parameters['limit'] . ' ';
switch ($parameters['what']) {
case 'document':
$title .= 'Pages';
break;
case 'entry_document':
$title .= 'Entry Pages';
break;
case 'exit_document':
$title .= 'Exit Pages';
break;
case 'exit_target':
$title .= 'Exit Targets';
break;
case 'host':
$title .= 'Hosts';
break;
case 'operating_system':
$title .= 'Operating Systems';
break;
case 'referer':
$title .= 'Referers';
break;
case 'user_agent':
$title .= 'User Agents';
break;
}
$title .= " (Total: {$total})";
for ($i = 0, $numValues = sizeof($values); $i < $numValues; $i++) {
$legend[$i] = sprintf('%s (%s, %s%%%%)', $names[$i], $values[$i], $percent[$i]);
}
$graph = new PieGraph($parameters['width'], $parameters['height'], 'auto');
$graph->SetShadow();
$graph->title->Set($title);
$graph->title->SetFont($parameters['font'], $parameters['font_style'], $parameters['font_size']);
$graph->title->SetColor('black');
$graph->legend->Pos(0.1, 0.2);
$plot = new PiePlot3d($values);
$plot->SetTheme('sand');
$plot->SetCenter(0.4);
$plot->SetAngle(30);
$plot->value->SetFont($parameters['font'], $parameters['font_style'], $parameters['font_size'] - 2);
$plot->SetLegends($legend);
$graph->Add($plot);
$graph->Stroke();
}
示例5: generate_image
function generate_image($lang, $idx)
{
global $LANGUAGES;
$up_to_date = get_stats($idx, $lang, 'uptodate');
$up_to_date = $up_to_date[0];
//
$outdated = @get_stats($idx, $lang, 'outdated');
$outdated = $outdated[0];
//
$missing = get_stats($idx, $lang, 'notrans');
$missing = $missing[0];
//
$no_tag = @get_stats($idx, $lang, 'norev');
$no_tag = $no_tag[0];
$data = array($up_to_date, $outdated, $missing, $no_tag);
$percent = array();
$total = array_sum($data);
// Total ammount in EN manual (to calculate percentage values)
$total_files_lang = $total - $missing;
// Total ammount of files in translation
foreach ($data as $value) {
$percent[] = round($value * 100 / $total);
}
$legend = array($percent[0] . '%% up to date (' . $up_to_date . ')', $percent[1] . '%% outdated (' . $outdated . ')', $percent[2] . '%% missing (' . $missing . ')', $percent[3] . '%% without EN-Revision (' . $no_tag . ')');
$title = 'Details for ' . $LANGUAGES[$lang] . ' PHP Manual';
$graph = new PieGraph(530, 300);
$graph->SetShadow();
$graph->title->Set($title);
$graph->title->Align('left');
$graph->title->SetFont(FF_FONT1, FS_BOLD);
$graph->legend->Pos(0.02, 0.18, "right", "center");
$graph->subtitle->Set('(Total: ' . $total_files_lang . ' files)');
$graph->subtitle->Align('left');
$graph->subtitle->SetColor('darkred');
$t1 = new Text(date('m/d/Y'));
$t1->SetPos(522, 294);
$t1->SetFont(FF_FONT1, FS_NORMAL);
$t1->Align("right", 'bottom');
$t1->SetColor("black");
$graph->AddText($t1);
$p1 = new PiePlot3D($data);
$p1->SetSliceColors(array("#68d888", "#ff6347", "#dcdcdc", "#f4a460"));
if ($total_files_lang != $up_to_date) {
$p1->ExplodeAll();
}
$p1->SetCenter(0.35, 0.55);
$p1->value->Show(false);
$p1->SetLegends($legend);
$graph->Add($p1);
$graph->Stroke("../www/images/revcheck/info_revcheck_php_{$lang}.png");
}
示例6: PieChart
function PieChart($w, $h, $title, $data, $dataL, $output)
{
$graph = new PieGraph($w, $h, "auto");
$graph->SetFrame(false);
$graph->SetShadow(false);
$graph->title->Set($title);
$graph->title->SetFont(FF_FONT1, FS_BOLD);
$p1 = new PiePlot3D($data);
$p1->SetAngle(20);
$p1->SetSize(0.5);
$p1->SetCenter(0.45);
$p1->SetLegends($dataL);
$graph->Add($p1);
$graph->Stroke($output);
}
示例7: graficarPDF
function graficarPDF()
{
$solo_registrados = contar("SELECT COUNT(*) FROM pasantia INNER JOIN periodo ON periodo.id = pasantia.periodo_id WHERE pasantia.m01_registrada IS NOT NULL AND pasantia.m02_aceptada IS NULL AND periodo.activo = TRUE");
$solo_aceptadas = contar("SELECT COUNT(*) FROM pasantia INNER JOIN periodo ON periodo.id = pasantia.periodo_id WHERE pasantia.m02_aceptada IS NOT NULL AND pasantia.m03_numero_asignado IS NULL AND periodo.activo = TRUE");
$solo_numero_asignado = contar("SELECT COUNT(*) FROM pasantia INNER JOIN periodo ON periodo.id = pasantia.periodo_id WHERE pasantia.m03_numero_asignado IS NOT NULL AND pasantia.m04_sellada IS NULL AND periodo.activo = TRUE");
$solo_sellada = contar("SELECT COUNT(*) FROM pasantia INNER JOIN periodo ON periodo.id = pasantia.periodo_id WHERE pasantia.m04_sellada IS NOT NULL AND pasantia.m05_entrego_copia IS NULL AND periodo.activo = TRUE");
$solo_entrego_copia = contar("SELECT COUNT(*) FROM pasantia INNER JOIN periodo ON periodo.id = pasantia.periodo_id WHERE pasantia.m05_entrego_copia IS NOT NULL AND pasantia.m06_entrego_borrador IS NULL AND periodo.activo = TRUE");
$solo_entrego_borrador = contar("SELECT COUNT(*) FROM pasantia INNER JOIN periodo ON periodo.id = pasantia.periodo_id WHERE pasantia.m06_entrego_borrador IS NOT NULL AND pasantia.m07_retiro_borrador IS NULL AND periodo.activo = TRUE");
$solo_retiro_borrador = contar("SELECT COUNT(*) FROM pasantia INNER JOIN periodo ON periodo.id = pasantia.periodo_id WHERE pasantia.m07_retiro_borrador IS NOT NULL AND pasantia.m08_entrega_final IS NULL AND periodo.activo = TRUE");
$finalizaron = contar("SELECT COUNT(*) FROM pasantia INNER JOIN periodo ON periodo.id = pasantia.periodo_id WHERE pasantia.m08_entrega_final IS NOT NULL AND periodo.activo = TRUE");
$this->MultiCell(200, 5, utf8_decode("\nRepública Bolivariana de Venezuela\nUniversidad del Zulia\nFacultad Experimental de Ciencias\nDivisión de Programas Especiales\nSistema de Pasantías\n\n\n\nEstadísticas de Hitos"), 0, "C", 0);
//GENERAR LA TABLA
$this->SetXY(5, 65);
$this->SetFont('Arial', 'B', 12);
$this->SetWidths(array(27, 25, 25, 25, 25, 25, 25, 25));
$this->SetAligns(array('C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C'));
$this->Row(array("Registradas", "Aceptadas", "Numero Asignado", "Selladas", "Entrega Copia", "Entrega Borrador", "Retiro Borrador", "Finalizaron"));
$this->SetX(5);
$this->SetFont('Arial', '', 12);
$this->SetWidths(array(27, 25, 25, 25, 25, 25, 25, 25));
$this->SetAligns(array('C', 'C', 'C', 'C', 'C', 'C', 'C', 'C'));
$this->Row(array("{$solo_registrados}", "{$solo_aceptadas}", "{$solo_numero_asignado}", "{$solo_sellada}", "{$solo_entrego_copia}", "{$solo_entrego_borrador}", "{$solo_retiro_borrador}", "{$finalizaron}"));
$data = array($solo_registrados, $solo_aceptadas, $solo_numero_asignado, $solo_sellada, $solo_entrego_copia, $solo_entrego_borrador, $solo_retiro_borrador, $finalizaron);
//aqui va la cantidad que llevará cada parte del grafico
$graph = new PieGraph(640, 480);
//tamaño de la letra del titulo y la leyenda
$graph->SetShadow();
$db = new PgDB();
//QUERY PARA EL PERIDO ACTIVO
$queryPer = "SELECT tipo, anio FROM periodo WHERE activo = TRUE";
$recoPer = pg_query($queryPer);
$rowPer = pg_fetch_array($recoPer);
$graph->title->Set(utf8_decode("REPORTE TOTAL\n{$rowPer['tipo']} - {$rowPer['anio']}"));
$graph->title->SetFont(FF_FONT2, FS_BOLD);
$p1 = new PiePlot($data);
$p1->value->Show(true);
$p1->SetLegends(array("Registradas", "Aceptadas", "Numeros Asignados", "Selladas", "Entrega de Copias", "Entrega de Borrador", "Retiro de Borrador", "Finalizaron"));
//la leyenda del gráfico
$p1->SetSize(0.3);
//el radio del gráfico
//$p1->SetAngle(45); //setear el angulo
$graph->Add($p1);
$graph->Stroke("asd.png");
$this->Image("asd.png", -15, 85, 240, 180);
// x, y, ancho, altura.
$this->Image("logotipo.jpg", 20, 12, -280);
unlink("asd.png");
}
示例8: 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();
}
示例9: array
/**
* @@生成三维饼图
* @param string $title
* @param array $data
* @param int $size
* @param int $height
* @param int $width
* @param array $legend
*/
static function create3dpie($title, $data = array(), $size = 40, $height = 100, $width = 80, $legend = array(), $slice = 0)
{
//包含相关的文件
vendor("Jpgraph.jpgraph");
vendor("Jpgraph.jpgraph_pie");
vendor("Jpgraph.jpgraph_pie3d");
// 创建图表
$graph = new PieGraph($width, $height, "auto");
$graph->SetShadow();
// 设置标题
$graph->title->Set(iconv("utf-8", "gb2312", $title));
//$graph->title->SetFont(FF_VERDANA,FS_BOLD,18);
$graph->title->SetFont(FF_SIMSUN, FS_BOLD, 18);
$graph->title->SetColor("darkblue");
$graph->legend->Pos(0.1, 0.2);
$graph->SetFrame(false, '#ffffff', 0);
//去掉周围的边框
// Create 3D pie plot
$p1 = new PiePlot3d($data);
$p1->SetTheme("sand");
$p1->SetCenter(0.4);
$p1->SetSize($size);
// Adjust projection angle
$p1->SetAngle(70);
// As a shortcut you can easily explode one numbered slice with
if ($slice == 0) {
$p1->ExplodeSlice(3);
}
// Setup the slice values
$p1->value->SetFont(FF_ARIAL, FS_BOLD, 10);
//$p1->value->SetFont(FF_SIMSUN,FS_BOLD,11);
$p1->value->SetColor("navy");
$graph->legend->SetFont(FF_SIMSUN, FS_BOLD, 8);
//编码转化
foreach ($legend as $k => $v) {
$legend[$k] = iconv('utf-8', 'gb2312', $v);
}
$p1->SetLegends($legend);
$graph->Add($p1);
$graph->Stroke();
}
示例10: array
function generate_graph_image()
{
// Create the graph.
// Set up Font Mapping Arrays
$fontfamilies = array("Font 0" => FF_FONT0, "Font 1" => FF_FONT1, "Font 2" => FF_FONT2, "Font0" => FF_FONT0, "Font1" => FF_FONT1, "Font2" => FF_FONT2, "Arial" => FF_ARIAL, "Verdana" => FF_VERDANA, "Courier" => FF_COURIER, "Comic" => FF_COMIC, "Times" => FF_TIMES, "Georgia" => FF_GEORGIA, "Trebuchet" => FF_TREBUCHE, "advent_light" => advent_light, "Bedizen" => Bedizen, "Mukti_Narrow" => Mukti_Narrow, "calibri" => calibri, "Forgotte" => Forgotte, "GeosansLight" => GeosansLight, "MankSans" => MankSans, "pf_arma_five" => pf_arma_five, "Silkscreen" => Silkscreen, "verdana" => verdana, "Vera" => FF_VERA);
$fontstyles = array("Normal" => FS_NORMAL, "Bold" => FS_BOLD, "Italic" => FS_ITALIC, "Bold+Italic" => FS_BOLDITALIC);
$this->apply_defaults();
if (!function_exists("imagecreatefromstring")) {
handle_error("Graph Option Not Available. Requires GD2");
return;
}
if ($this->plot[0]["type"] == "PIE" || $this->plot[0]["type"] == "PIE3D") {
$graph = new PieGraph($this->width_actual, $this->height_actual, "auto");
$graph->SetScale("textlin");
$graph->img->SetMargin($this->marginleft_actual, $this->marginright_actual, $this->margintop_actual, $this->marginbottom_actual);
$graph->SetMarginColor($this->margincolor_actual);
$graph->img->SetAntiAliasing();
$graph->SetColor($this->graphcolor_actual);
$graph->SetShadow();
$graph->xaxis->SetTitleMargin($this->marginbottom_actual - 45);
$graph->yaxis->SetTitleMargin($this->marginleft_actual - 25);
} else {
$graph = new Graph($this->width_actual, $this->height_actual, "auto");
$graph->SetScale("textlin");
$graph->img->SetMargin($this->marginleft_actual, $this->marginright_actual, $this->margintop_actual, $this->marginbottom_actual);
$graph->SetMarginColor($this->margincolor_actual);
$graph->img->SetAntiAliasing();
$graph->SetColor($this->graphcolor_actual);
$graph->SetShadow();
$graph->xaxis->SetTitleMargin($this->marginbottom_actual - 45);
$graph->yaxis->SetTitleMargin($this->marginleft_actual - 25);
}
$lplot = array();
$lplotct = 0;
foreach ($this->plot as $k => $v) {
switch ($v["type"]) {
case "PIE":
$lplot[$lplotct] = new PiePlot($v["data"]);
$lplot[$lplotct]->SetColor($v["linecolor"]);
foreach ($xlabels as $k => $v) {
$xlabels[$k] = $v . "\n %.1f%%";
}
$lplot[$lplotct]->SetLabels($xlabels, 1.0);
$graph->Add($lplot[$lplotct]);
break;
case "PIE3D":
$lplot[$lplotct] = new PiePlot3D($v["data"]);
$lplot[$lplotct]->SetColor($v["linecolor"]);
foreach ($xlabels as $k => $v) {
$xlabels[$k] = $v . "\n %.1f%%";
}
$lplot[$lplotct]->SetLabels($xlabels, 1.0);
$graph->Add($lplot[$lplotct]);
break;
case "STACKEDBAR":
case "BAR":
$lplot[$lplotct] = new BarPlot($v["data"]);
$lplot[$lplotct]->SetColor($v["linecolor"]);
$lplot[$lplotct]->SetWidth(0.8);
//$lplot[$lplotct]->SetWeight(5);
if ($v["fillcolor"]) {
$lplot[$lplotct]->SetFillColor($v["fillcolor"]);
}
if ($v["legend"]) {
$lplot[$lplotct]->SetLegend($v["legend"]);
}
$graph->Add($lplot[$lplotct]);
break;
case "LINE":
default:
if (count($v["data"]) == 1) {
$v["data"][] = 0;
}
$lplot[$lplotct] = new LinePlot($v["data"]);
$lplot[$lplotct]->SetColor($v["linecolor"]);
//$lplot[$lplotct]->SetWeight(5);
if ($v["fillcolor"]) {
$lplot[$lplotct]->SetFillColor($v["fillcolor"]);
}
if ($v["legend"]) {
$lplot[$lplotct]->SetLegend($v["legend"]);
}
$graph->Add($lplot[$lplotct]);
break;
}
$lplotct++;
}
$graph->title->Set($this->title_actual);
$graph->xaxis->title->Set($this->xtitle_actual);
$graph->yaxis->title->Set($this->ytitle_actual);
$graph->xgrid->SetColor($this->xgridcolor_actual);
$graph->ygrid->SetColor($this->ygridcolor_actual);
switch ($this->xgriddisplay_actual) {
case "all":
$graph->xgrid->Show(true, true);
break;
case "major":
$graph->xgrid->Show(true, false);
break;
case "minor":
//.........这里部分代码省略.........
示例11: array
// content="text/plain; charset=utf-8"
require_once 'jpgraph/jpgraph.php';
require_once 'jpgraph/jpgraph_pie.php';
require_once 'jpgraph/jpgraph_pie3d.php';
// Some data
$data = array(array(80, 18, 15, 17), array(35, 28, 6, 34), array(10, 28, 10, 5), array(22, 22, 10, 17));
$piepos = array(0.2, 0.4, 0.65, 0.28, 0.25, 0.75, 0.8, 0.75);
$titles = array('USA', 'Sweden', 'South America', 'Australia');
$n = count($piepos) / 2;
// A new graph
$graph = new PieGraph(550, 400, 'auto');
// Specify margins since we put the image in the plot area
$graph->SetMargin(1, 1, 40, 1);
$graph->SetMarginColor('navy');
$graph->SetShadow(false);
// Setup background
$graph->SetBackgroundImage('worldmap1.jpg', BGIMG_FILLPLOT);
// Setup title
$graph->title->Set("Pie plots with background image");
$graph->title->SetFont(FF_ARIAL, FS_BOLD, 20);
$graph->title->SetColor('white');
$p = array();
// Create the plots
for ($i = 0; $i < $n; ++$i) {
$d = "data{$i}";
$p[] = new PiePlot3D($data[$i]);
}
// Position the four pies
for ($i = 0; $i < $n; ++$i) {
$p[$i]->SetCenter($piepos[2 * $i], $piepos[2 * $i + 1]);
示例12: pie_chart
public function pie_chart($piedata, $legentdata, $title)
{
require_once 'Examples/jpgraph/jpgraph.php';
require_once 'Examples/jpgraph/jpgraph_pie.php';
require_once 'Examples/jpgraph/jpgraph_pie3d.php';
$graph = new PieGraph(800, 450);
$graph->SetShadow();
$graph->title->SetFont(FF_SIMSUN, FS_BOLD, 12);
// 设置中文字体
$graph->title->Set($title . "饼状图");
$graph->SetFrame(false);
$p1 = new PiePlot3D($piedata);
$p1->SetSize(0.4);
$p1->SetCenter(0.3);
$p1->SetLegends($legentdata);
$p1->SetLabelMargin(10);
$graph->legend->SetFont(FF_SIMSUN, FS_NORMAL);
$graph->legend->Pos(0.03, 0.18, 'right', 'top');
$graph->legend->SetLayout(LEGEND_HOR);
$graph->legend->SetColumns(2);
$graph->legend->SetVColMargin(0);
$graph->Add($p1);
$graph->SetImgFormat('png', 90);
$graph->Stroke();
}
示例13: 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);
//.........这里部分代码省略.........
示例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: crearPie
function crearPie($pdf, $verde, $rojo, $ciclos, $alineacion)
{
$data = array($verde, $rojo);
$labels = array("Valores\ndentro de\nnorma\n(%.1f%%)", "Valores\nfuera de\nnorma\n(%.1f%%)");
$graph = new PieGraph(310, 200);
$graph->SetShadow();
$graph->title->Set(utf8_decode("Análisis de resultados " . $ciclos));
$graph->title->SetFont(FF_FONT1, FS_BOLD);
$p1 = new PiePlot3D($data);
$p1->SetSize(0.5);
$p1->SetCenter(0.5);
$p1->ExplodeAll(15);
$p1->SetStartAngle(60);
$p1->SetLabels($labels);
$p1->SetLabelPos(0);
$p1->value->SetColor('black');
$graph->Add($p1);
$p1->SetSliceColors(array('green', 'red'));
//$graph->Stroke();
$nombreImagen = '' . uniqid() . '.png';
// Display the graph
$graph->Stroke($nombreImagen);
if ($alineacion === 'C') {
$pdf->Image($nombreImagen, 145, 145, 55, 45);
} elseif ($alineacion === 'L') {
$pdf->Image($nombreImagen, 90, 145, 55, 45);
} elseif ($alineacion === 'R') {
$pdf->Image($nombreImagen, 195, 145, 55, 45);
} elseif ($alineacion === 'C1') {
$pdf->Image($nombreImagen, 75, 205, 55, 45);
} elseif ($alineacion === 'L1') {
$pdf->Image($nombreImagen, 20, 205, 55, 45);
} elseif ($alineacion === 'R1') {
$pdf->Image($nombreImagen, 125, 205, 55, 45);
} elseif ($alineacion === 'C2') {
$pdf->Image($nombreImagen, 75, 160, 55, 45);
}
unlink($nombreImagen);
}