function makeGraph($x_data, $y_data, $num_results, $title = "Statistics", $graph_type = "bar", $graph_scale = "textint")
{
    // default graph info
    $width = 600;
    $height = 500;
    $top = 60;
    $bottom = 30;
    $left = 80;
    $right = 30;
    if ($graph_type != 'csv' && $num_results == 0) {
        header('Content-type: image/png');
        readfile($GLOBALS['BASE_DIR'] . '/images/no-calls.png');
        exit;
    }
    // Set the basic parameters of the graph
    switch ($graph_type) {
        case "line":
            //do line graph here
            break;
            // not really a graph, returns comma seperated values
        // not really a graph, returns comma seperated values
        case "csv":
            header("content-type: text/csv");
            header('Content-Disposition: attachment; filename="statistics.csv"');
            $columns = implode(',', $x_data);
            $rows = implode(',', $y_data);
            echo $columns . "\n" . $rows;
            break;
        case "bar":
        default:
            // bar is default
            $graph = new Graph($width, 90 + 10 * $num_results, 'auto');
            $graph->SetScale($graph_scale);
            // Nice shadow
            $graph->SetShadow();
            $graph->Set90AndMargin($left, $right, $top, $bottom);
            // Setup labels
            $graph->xaxis->SetTickLabels($x_data);
            // Label align for X-axis
            $graph->xaxis->SetLabelAlign('right', 'center', 'right');
            // Label align for Y-axis
            $graph->yaxis->SetLabelAlign('center', 'bottom');
            // Create a bar pot
            $bplot = new BarPlot($y_data);
            $bplot->SetFillColor("#708090");
            $bplot->SetWidth(0.5);
            $bplot->SetYMin(0);
            //$bplot->SetYMin(1990);
            $graph->title->Set($title);
            $graph->Add($bplot);
            $graph->Stroke();
    }
}
Example #2
0
 /**
  * Build a graph onto disk using Artichow library
  *
  * @param	string	$file    	Image file name to use if we save onto disk
  * @param	string	$fileurl	Url path to show image if saved onto disk
  * @return	void
  */
 private function draw_artichow($file, $fileurl)
 {
     global $artichow_defaultfont;
     dol_syslog(get_class($this) . "::draw_artichow this->type=" . join(',', $this->type));
     if (!defined('SHADOW_RIGHT_TOP')) {
         define('SHADOW_RIGHT_TOP', 3);
     }
     if (!defined('LEGEND_BACKGROUND')) {
         define('LEGEND_BACKGROUND', 2);
     }
     if (!defined('LEGEND_LINE')) {
         define('LEGEND_LINE', 1);
     }
     // Create graph
     $classname = '';
     if (!isset($this->type[0]) || $this->type[0] == 'bars') {
         $classname = 'BarPlot';
     } else {
         if ($this->type[0] == 'lines') {
             $classname = 'LinePlot';
         } else {
             $classname = 'TypeUnknown';
         }
     }
     include_once ARTICHOW_PATH . $classname . '.class.php';
     // Definition de couleurs
     $bgcolor = new Color($this->bgcolor[0], $this->bgcolor[1], $this->bgcolor[2]);
     $bgcolorgrid = new Color($this->bgcolorgrid[0], $this->bgcolorgrid[1], $this->bgcolorgrid[2]);
     $colortrans = new Color(0, 0, 0, 100);
     $colorsemitrans = new Color(255, 255, 255, 60);
     $colorgradient = new LinearGradient(new Color(235, 235, 235), new Color(255, 255, 255), 0);
     $colorwhite = new Color(255, 255, 255);
     // Graph
     $graph = new Graph($this->width, $this->height);
     $graph->border->hide();
     $graph->setAntiAliasing(true);
     if (isset($this->title)) {
         $graph->title->set($this->title);
         //print $artichow_defaultfont;exit;
         $graph->title->setFont(new $artichow_defaultfont(10));
     }
     if (is_array($this->bgcolor)) {
         $graph->setBackgroundColor($bgcolor);
     } else {
         $graph->setBackgroundGradient($colorgradient);
     }
     $group = new PlotGroup();
     //$group->setSpace(5, 5, 0, 0);
     $paddleft = 50;
     $paddright = 10;
     $strl = dol_strlen(max(abs($this->MaxValue), abs($this->MinValue)));
     if ($strl > 6) {
         $paddleft += $strl * 4;
     }
     $group->setPadding($paddleft, $paddright);
     // Width on left and right for Y axis values
     $group->legend->setSpace(0);
     $group->legend->setPadding(2, 2, 2, 2);
     $group->legend->setPosition(NULL, 0.1);
     $group->legend->setBackgroundColor($colorsemitrans);
     if (is_array($this->bgcolorgrid)) {
         $group->grid->setBackgroundColor($bgcolorgrid);
     } else {
         $group->grid->setBackgroundColor($colortrans);
     }
     if ($this->hideXGrid) {
         $group->grid->hideVertical(true);
     }
     if ($this->hideYGrid) {
         $group->grid->hideHorizontal(true);
     }
     // On boucle sur chaque lot de donnees
     $legends = array();
     $i = 0;
     $nblot = count($this->data[0]) - 1;
     while ($i < $nblot) {
         $x = 0;
         $values = array();
         foreach ($this->data as $key => $valarray) {
             $legends[$x] = $valarray[0];
             $values[$x] = $valarray[$i + 1];
             $x++;
         }
         // We fix unknown values to null
         $newvalues = array();
         foreach ($values as $val) {
             $newvalues[] = is_numeric($val) ? $val : null;
         }
         if ($this->type[0] == 'bars') {
             //print "Lot de donnees $i<br>";
             //print_r($values);
             //print '<br>';
             $color = new Color($this->datacolor[$i][0], $this->datacolor[$i][1], $this->datacolor[$i][2], 20);
             $colorbis = new Color(min($this->datacolor[$i][0] + 50, 255), min($this->datacolor[$i][1] + 50, 255), min($this->datacolor[$i][2] + 50, 255), 50);
             $colorgrey = new Color(100, 100, 100);
             $colorborder = new Color($this->datacolor[$i][0], $this->datacolor[$i][1], $this->datacolor[$i][2]);
             if ($this->mode == 'side') {
                 $plot = new BarPlot($newvalues, $i + 1, $nblot);
             }
             if ($this->mode == 'depth') {
                 $plot = new BarPlot($newvalues, 1, 1, ($nblot - $i - 1) * 5);
             }
             $plot->barBorder->setColor($colorgrey);
             //$plot->setBarColor($color);
             $plot->setBarGradient(new LinearGradient($colorbis, $color, 90));
             if ($this->mode == 'side') {
                 $plot->setBarPadding(0.1, 0.1);
             }
             if ($this->mode == 'depth') {
                 $plot->setBarPadding(0.1, 0.4);
             }
             if ($this->mode == 'side') {
                 $plot->setBarSpace(5);
             }
             if ($this->mode == 'depth') {
                 $plot->setBarSpace(2);
             }
             $plot->barShadow->setSize($this->SetShading);
             $plot->barShadow->setPosition(SHADOW_RIGHT_TOP);
             $plot->barShadow->setColor(new Color(160, 160, 160, 50));
             $plot->barShadow->smooth(TRUE);
             //$plot->setSize(1, 0.96);
             //$plot->setCenter(0.5, 0.52);
             // Le mode automatique est plus efficace
             $plot->SetYMax($this->MaxValue);
             $plot->SetYMin($this->MinValue);
         }
         if ($this->type[0] == 'lines') {
             $color = new Color($this->datacolor[$i][0], $this->datacolor[$i][1], $this->datacolor[$i][2], 20);
             $colorbis = new Color(min($this->datacolor[$i][0] + 20, 255), min($this->datacolor[$i][1] + 20, 255), min($this->datacolor[$i][2] + 20, 255), 60);
             $colorter = new Color(min($this->datacolor[$i][0] + 50, 255), min($this->datacolor[$i][1] + 50, 255), min($this->datacolor[$i][2] + 50, 255), 90);
             $plot = new LinePlot($newvalues);
             //$plot->setSize(1, 0.96);
             //$plot->setCenter(0.5, 0.52);
             $plot->setColor($color);
             $plot->setThickness(1);
             // Set line background gradient
             $plot->setFillGradient(new LinearGradient($colorter, $colorbis, 90));
             $plot->xAxis->setLabelText($legends);
             // Le mode automatique est plus efficace
             $plot->SetYMax($this->MaxValue);
             $plot->SetYMin($this->MinValue);
             //$plot->setYAxis(0);
             //$plot->hideLine(true);
         }
         //$plot->reduce(80);		// Evite temps d'affichage trop long et nombre de ticks absisce satures
         $group->legend->setTextFont(new $artichow_defaultfont(10));
         // This is to force Artichow to use awFileFontDriver to
         // solve a bug in Artichow with UTF8
         if (count($this->Legend)) {
             if ($this->type[0] == 'bars') {
                 $group->legend->add($plot, $this->Legend[$i], LEGEND_BACKGROUND);
             }
             if ($this->type[0] == 'lines') {
                 $group->legend->add($plot, $this->Legend[$i], LEGEND_LINE);
             }
         }
         $group->add($plot);
         $i++;
     }
     $group->axis->bottom->setLabelText($legends);
     $group->axis->bottom->label->setFont(new $artichow_defaultfont(7));
     //print $group->axis->bottom->getLabelNumber();
     if ($this->labelInterval > 0) {
         $group->axis->bottom->setLabelInterval($this->labelInterval);
     }
     $graph->add($group);
     // Generate file
     $graph->draw($file);
     $this->_stringtoshow = '<!-- Build using ' . $this->_library . ' --><img src="' . $fileurl . '" title="' . dol_escape_htmltag($this->title ? $this->title : $this->YLabel) . '" alt="' . dol_escape_htmltag($this->title ? $this->title : $this->YLabel) . '">';
 }
Example #3
0
require_once "jpgraph/jpgraph_bar.php";
$datay = array(1992, 1993, 1995, 1996, 1997, 1998, 2001);
// Size of graph
$width = 400;
$height = 500;
// Set the basic parameters of the graph
$graph = new Graph($width, $height);
$graph->SetScale('textlin');
$top = 60;
$bottom = 30;
$left = 80;
$right = 30;
$graph->Set90AndMargin($left, $right, $top, $bottom);
// Nice shadow
$graph->SetShadow();
// Setup labels
$lbl = array("Andrew\nTait", "Thomas\nAnderssen", "Kevin\nSpacey", "Nick\nDavidsson", "David\nLindquist", "Jason\nTait", "Lorin\nPersson");
$graph->xaxis->SetTickLabels($lbl);
// Label align for X-axis
$graph->xaxis->SetLabelAlign('right', 'center', 'right');
// Label align for Y-axis
$graph->yaxis->SetLabelAlign('center', 'bottom');
// Titles
$graph->title->Set('Number of incidents');
// Create a bar pot
$bplot = new BarPlot($datay);
$bplot->SetFillColor('orange');
$bplot->SetWidth(0.5);
$bplot->SetYMin(1990);
$graph->Add($bplot);
$graph->Stroke();
Example #4
0
function graficar_defectos($eje_y, $x_label, $pareto, $titulo_eje_x, $titulo_eje_y, $title, $name)
{
    include "../jpgraph/src/jpgraph.php";
    include "../jpgraph/src/jpgraph_line.php";
    include "../jpgraph/src/jpgraph_bar.php";
    $graph = new Graph(820, 350);
    $graph->SetScale("textlin");
    $graph->SetMarginColor("#FFFFFF");
    $graph->img->SetMargin(80, 80, 60, 140);
    $graph->yaxis->SetTitleMargin(40);
    $graph->SetBackgroundImage("../imagenes/fondo.jpg", BGIMG_FILLFRAME);
    $graph->xaxis->SetLabelAngle(90);
    $graph->xaxis->SetTickLabels($x_label);
    $graph->legend->Pos(0.03, 0.3);
    $graph->title->SetColor("#000000");
    $graph->title->Set($title);
    $graph->title->SetFont(FF_FONT1, FS_BOLD);
    $graph->yaxis->title->SetFont(FF_FONT1, FS_BOLD);
    $graph->xaxis->title->SetFont(FF_FONT1, FS_BOLD);
    //$graph->yaxis->title->Set($titulo_eje_y);
    //$graph->xaxis->title->Set($titulo_eje_x);
    $graph->setcolor("#EEEEEE");
    $graph->setshadow("true", 3, "#aaaaaa");
    // Crear la gráfica de barras
    $bplot1 = new BarPlot($eje_y);
    $bplot1->SetWidth(0.3);
    $bplot1->SetYMin(0.02);
    $bplot1->SetFillColor("orange@0.2");
    $bplot1->SetShadow('darkgray');
    $bplot1->value->SetFormat("%0.1f");
    $bplot1->value->SetColor("darkred");
    $bplot1->value->Show();
    // Crear la gráfica de líneas
    $lplot = new LinePlot($pareto);
    $lplot->mark->SetType(MARK_FILLEDCIRCLE);
    $lplot->mark->SetFillColor("red");
    $lplot->mark->SetWidth(3);
    $lplot->SetColor("blue");
    $lplot->SetBarCenter();
    $graph->Add($bplot1);
    $graph->Add($lplot);
    $graph->Stroke("charts/" . $name);
}
Example #5
0
require_once 'jpgraph/jpgraph.php';
require_once 'jpgraph/jpgraph_bar.php';
require_once 'jpgraph/jpgraph_line.php';
// We need some data
$datay = array(0.3031, 0.3044, 0.3049, 0.304, 0.3024, 0.3047);
// Setup the graph.
$graph = new Graph(400, 200);
$graph->img->SetMargin(60, 30, 30, 40);
$graph->SetScale("textlin");
$graph->SetMarginColor("teal");
$graph->SetShadow();
// Create the bar pot
$bplot = new BarPlot($datay);
$bplot->SetWidth(0.6);
// This is how you make the bar graph start from something other than 0
$bplot->SetYMin(0.302);
// Setup color for gradient fill style
$tcol = array(100, 100, 255);
$fcol = array(255, 100, 100);
$bplot->SetFillGradient($fcol, $tcol, GRAD_HOR);
$bplot->SetFillColor("orange");
$graph->Add($bplot);
// Set up the title for the graph
$graph->title->Set("Bargraph which doesn't start from y=0");
$graph->title->SetColor("yellow");
$graph->title->SetFont(FF_VERDANA, FS_BOLD, 12);
// Setup color for axis and labels
$graph->xaxis->SetColor("black", "white");
$graph->yaxis->SetColor("black", "white");
// Setup font for axis
$graph->xaxis->SetFont(FF_VERDANA, FS_NORMAL, 10);
Example #6
0
	/**
	 * 		Build a graph onto disk using Artichow library
	 *    	@param      file    Image file name on disk
	 */
	function draw_artichow($file)
	{
		dol_syslog("DolGraph.class::draw_artichow this->type=".$this->type);

		if (! defined('SHADOW_RIGHT_TOP'))  define('SHADOW_RIGHT_TOP',3);
		if (! defined('LEGEND_BACKGROUND')) define('LEGEND_BACKGROUND',2);
		if (! defined('LEGEND_LINE'))       define('LEGEND_LINE',1);

		// Create graph
		$classname='';
		if ($this->type == 'bars')  $classname='BarPlot';
		if ($this->type == 'lines') $classname='LinePlot';
		include_once DOL_DOCUMENT_ROOT."/includes/artichow/".$classname.".class.php";

		// Definition de couleurs
		$bgcolor=new Color($this->bgcolor[0],$this->bgcolor[1],$this->bgcolor[2]);
		$bgcolorgrid=new Color($this->bgcolorgrid[0],$this->bgcolorgrid[1],$this->bgcolorgrid[2]);
		$colortrans=new Color(0,0,0,100);
		$colorsemitrans=new Color(255,255,255,60);
		$colorgradient= new LinearGradient(new Color(235, 235, 235),new Color(255, 255, 255),0);
		$colorwhite=new Color(255,255,255);

		// Graph
		$graph = new Graph($this->width, $this->height);
		$graph->border->hide();
		$graph->setAntiAliasing(true);
		if (isset($this->title))
		{
			$graph->title->set($this->title);
			$graph->title->setFont(new Tuffy(10));
		}

		if (is_array($this->bgcolor)) $graph->setBackgroundColor($bgcolor);
		else $graph->setBackgroundGradient($colorgradient);

		$group = new PlotGroup;
		//$group->setSpace(5, 5, 0, 0);

		$paddleft=50;
		$paddright=10;
		$strl=dol_strlen(max(abs($this->MaxValue),abs($this->MinValue)));
		if ($strl > 6) $paddleft += ($strln * 4);
		$group->setPadding($paddleft, $paddright);		// Width on left and right for Y axis values
		$group->legend->setSpace(0);
		$group->legend->setPadding(2,2,2,2);
		$group->legend->setPosition(NULL,0.1);
		$group->legend->setBackgroundColor($colorsemitrans);

		if (is_array($this->bgcolorgrid)) $group->grid->setBackgroundColor($bgcolorgrid);
		else $group->grid->setBackgroundColor($colortrans);

		if ($this->hideXGrid)	$group->grid->hideVertical(true);
		if ($this->hideYGrid)	$group->grid->hideHorizontal(true);

		// On boucle sur chaque lot de donnees
		$legends=array();
		$i=0;
		$nblot=sizeof($this->data[0])-1;

		while ($i < $nblot)
		{
			$j=0;
			$values=array();
			foreach($this->data as $key => $valarray)
			{
				$legends[$j] = $valarray[0];
				$values[$j]  = $valarray[$i+1];
				$j++;
			}

			// Artichow ne gere pas les valeurs inconnues
			// Donc si inconnu, on la fixe a null
			$newvalues=array();
			foreach($values as $val)
			{
				$newvalues[]=(is_numeric($val) ? $val : null);
			}


			if ($this->type == 'bars')
			{
				//print "Lot de donnees $i<br>";
				//print_r($values);
				//print '<br>';

				$color=new Color($this->datacolor[$i][0],$this->datacolor[$i][1],$this->datacolor[$i][2],20);
				$colorbis=new Color(min($this->datacolor[$i][0]+50,255),min($this->datacolor[$i][1]+50,255),min($this->datacolor[$i][2]+50,255),50);

				$colorgrey=new Color(100,100,100);
				$colorborder=new Color($this->datacolor[$i][0],$this->datacolor[$i][1],$this->datacolor[$i][2]);

				if ($this->mode == 'side')  $plot = new BarPlot($newvalues, $i+1, $nblot);
				if ($this->mode == 'depth') $plot = new BarPlot($newvalues, 1, 1, ($nblot-$i-1)*5);

				$plot->barBorder->setColor($colorgrey);
				//$plot->setBarColor($color);
				$plot->setBarGradient( new LinearGradient($colorbis, $color, 90) );

				if ($this->mode == 'side')  $plot->setBarPadding(0.1, 0.1);
				if ($this->mode == 'depth') $plot->setBarPadding(0.1, 0.4);
				if ($this->mode == 'side')  $plot->setBarSpace(5);
				if ($this->mode == 'depth') $plot->setBarSpace(2);

				$plot->barShadow->setSize($this->SetShading);
				$plot->barShadow->setPosition(SHADOW_RIGHT_TOP);
				$plot->barShadow->setColor(new Color(160, 160, 160, 50));
				$plot->barShadow->smooth(TRUE);
				//$plot->setSize(1, 0.96);
				//$plot->setCenter(0.5, 0.52);

				// Le mode automatique est plus efficace
				$plot->SetYMax($this->MaxValue);
				$plot->SetYMin($this->MinValue);
			}

			if ($this->type == 'lines')
			{
				$color=new Color($this->datacolor[$i][0],$this->datacolor[$i][1],$this->datacolor[$i][2],20);
				$colorbis=new Color(min($this->datacolor[$i][0]+20,255),min($this->datacolor[$i][1]+20,255),min($this->datacolor[$i][2]+20,255),60);
				$colorter=new Color(min($this->datacolor[$i][0]+50,255),min($this->datacolor[$i][1]+50,255),min($this->datacolor[$i][2]+50,255),90);

				$plot = new LinePlot($newvalues);
				//$plot->setSize(1, 0.96);
				//$plot->setCenter(0.5, 0.52);

				$plot->setColor($color);
				$plot->setThickness(1);

				// Set line background gradient
				$plot->setFillGradient( new LinearGradient($colorter, $colorbis, 90) );

				$plot->xAxis->setLabelText($legends);

				// Le mode automatique est plus efficace
				$plot->SetYMax($this->MaxValue);
				$plot->SetYMin($this->MinValue);
				//$plot->setYAxis(0);
				//$plot->hideLine(true);
			}

			//$plot->reduce(80);		// Evite temps d'affichage trop long et nombre de ticks absisce satures

			$group->legend->setTextFont(new Tuffy(10)); // This is to force Artichow to use awFileFontDriver to
														// solve a bug in Artichow with UTF8
			if (sizeof($this->Legend))
			{
				if ($this->type == 'bars')  $group->legend->add($plot, $this->Legend[$i], LEGEND_BACKGROUND);
				if ($this->type == 'lines') $group->legend->add($plot, $this->Legend[$i], LEGEND_LINE);
			}
			$group->add($plot);

			$i++;
		}

		$group->axis->bottom->setLabelText($legends);
		$group->axis->bottom->label->setFont(new Tuffy(7));

		//print $group->axis->bottom->getLabelNumber();
		if ($this->labelInterval > 0) $group->axis->bottom->setLabelInterval($this->labelInterval);

		$graph->add($group);

		// Generate file
		$graph->draw($file);
	}
Example #7
0
 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);
     $graph->xaxis->SetLabelAlign('right', 'center', 'right');
     $graph->yaxis->SetLabelAlign('center', 'bottom');
     $graph->title->Set('Amount of hands won by individual players');
     $bplot = new BarPlot($data);
     $bplot->SetFillGradient("navy", "lightsteelblue", GRAD_HOR);
     $bplot->SetWidth(0.5);
     $bplot->SetYMin(0);
     $graph->Add($bplot);
     $graph->Stroke(sprintf('logs/playerwins_%d.jpg', $gameid));
     $this->newgame = false;
     // Remove the clients from the server
     $this->broadcast("[SERVER] Thank you for playing Texas Hold`em (LIMIT)\n[SERVER] If you want to play another game, just reconnect to the server!");
     $this->return = true;
     foreach ($this->players as $player) {
         $this->disconnect($player);
     }
     $this->return = true;
     $this->restore();
 }