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


PHP Graph::add方法代码示例

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


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

示例1: execute

 function execute()
 {
     $this->set_title('Statistics Center');
     $this->tree('Statistics Center');
     if (!extension_loaded('gd')) {
         return $this->message('JpGraph Error', 'You need to install the correct GD libraries to run the Statistics centre (GD Libraries were not detected)');
     }
     include '../lib/jpgraph/jpgraph.php';
     include '../lib/jpgraph/jpgraph_bar.php';
     if (!defined('IMG_PNG')) {
         return $this->message('JpGraph Error', 'This PHP installation is not configured with PNG support. Please recompile PHP with GD and JPEG support to run JpGraph. (Constant IMG_PNG does not exist)');
     }
     /**
      * Posts
      */
     $query = $this->db->query("\r\n\t\tSELECT\r\n\t\t    COUNT(post_id) AS posts,\r\n\t\t    FROM_UNIXTIME(post_time, '%b %y') AS month\r\n\t\tFROM {$this->pre}posts\r\n\t\tGROUP BY month\r\n\t\tORDER BY post_time");
     $data = array();
     while ($item = $this->db->nqfetch($query)) {
         $data[$item['month']] = $item['posts'];
     }
     if (!$data) {
         $data = array(0, 0);
     }
     $graph = new Graph(400, 300, 'auto');
     $graph->SetScale('textint');
     $graph->SetColor('aliceblue');
     $graph->SetMarginColor('white');
     $graph->xaxis->SetTickLabels(array_keys($data));
     $graph->yaxis->scale->SetGrace(20);
     $graph->title->Set('Posts by Month');
     $temp = array_values($data);
     $barplot = new BarPlot($temp);
     $barplot->SetFillColor('darkorange');
     $graph->add($barplot);
     $graph->Stroke("{$this->time}1.png");
     /**
      * Registrations
      */
     $query = $this->db->query("\r\n\t\tSELECT\r\n\t\t    COUNT(user_id) AS users,\r\n\t\t    FROM_UNIXTIME(user_joined, '%b %y') AS month\r\n\t\tFROM {$this->pre}users\r\n\t\tWHERE user_joined != 0\r\n\t\tGROUP BY month\r\n\t\tORDER BY user_joined");
     $data = array();
     while ($item = $this->db->nqfetch($query)) {
         $data[$item['month']] = $item['users'];
     }
     $graph = new Graph(400, 300, 'auto');
     $graph->SetScale('textint');
     $graph->SetColor('aliceblue');
     $graph->SetMarginColor('white');
     $graph->xaxis->SetTickLabels(array_keys($data));
     $graph->yaxis->scale->SetGrace(20);
     $graph->title->Set('Registrations by Month');
     $temp = array_values($data);
     $barplot = new BarPlot($temp);
     $barplot->SetFillColor('darkorange');
     $graph->add($barplot);
     $graph->Stroke("{$this->time}2.png");
     return $this->message('Statistics Center', "<img src='{$this->time}1.png' alt='Posts by Month' /><br /><br />\r\n\t\t<img src='{$this->time}2.png' alt='Registrations by Month' />");
 }
开发者ID:BackupTheBerlios,项目名称:mercuryb-svn,代码行数:57,代码来源:stats.php

示例2: execute

 function execute()
 {
     $this->set_title($this->lang->stats);
     $this->tree($this->lang->stats);
     include '../lib/jpgraph/jpgraph.php';
     include '../lib/jpgraph/jpgraph_bar.php';
     if (!defined('IMG_PNG')) {
         JpGraphError::Raise("This PHP installation is not configured with PNG support. Please recompile PHP with GD and JPEG support to run JpGraph. (Constant IMG_PNG does not exist)");
     }
     /**
      * Posts
      */
     $query = $this->db->query("SELECT COUNT(post_id) AS posts, FROM_UNIXTIME(post_time, '%%b %%y') AS month\n\t\t\tFROM %pposts GROUP BY month\tORDER BY post_time");
     $data = array();
     while ($item = $this->db->nqfetch($query)) {
         $data[$item['month']] = $item['posts'];
     }
     if (!$data) {
         $data = array(0, 0);
     }
     $graph = new Graph(400, 300, 'auto');
     $graph->SetScale('textint');
     $graph->SetColor('aliceblue');
     $graph->SetMarginColor('white');
     $graph->xaxis->SetTickLabels(array_keys($data));
     $graph->yaxis->scale->SetGrace(20);
     $graph->title->Set($this->lang->stats_post_by_month);
     $temp = array_values($data);
     $barplot = new BarPlot($temp);
     $barplot->SetFillColor('darkorange');
     $graph->add($barplot);
     $graph->Stroke("../stats/{$this->time}1.png");
     /**
      * Registrations
      */
     $query = $this->db->query("SELECT COUNT(user_id) AS users, FROM_UNIXTIME(user_joined, '%%b %%y') AS month\n\t\t\tFROM %pusers\n\t\t\tWHERE user_joined != 0\n\t\t\tGROUP BY month\n\t\t\tORDER BY user_joined");
     $data = array();
     while ($item = $this->db->nqfetch($query)) {
         $data[$item['month']] = $item['users'];
     }
     $graph = new Graph(400, 300, 'auto');
     $graph->SetScale('textint');
     $graph->SetColor('aliceblue');
     $graph->SetMarginColor('white');
     $graph->xaxis->SetTickLabels(array_keys($data));
     $graph->yaxis->scale->SetGrace(20);
     $graph->title->Set($this->lang->stats_reg_by_month);
     $temp = array_values($data);
     $barplot = new BarPlot($temp);
     $barplot->SetFillColor('darkorange');
     $graph->add($barplot);
     $graph->Stroke("../stats/{$this->time}2.png");
     return $this->message($this->lang->stats, "<img src='../stats/{$this->time}1.png' alt='{$this->lang->stats_post_by_month}' /><br /><br />\n\t\t<img src='../stats/{$this->time}2.png' alt='{$this->lang->stats_reg_by_month}' />");
 }
开发者ID:BackupTheBerlios,项目名称:qsf-svn,代码行数:54,代码来源:stats.php

示例3: execute

 function execute()
 {
     $this->set_title($this->lang->stats);
     $this->tree($this->lang->stats);
     include '../lib/jpgraph/jpgraph.php';
     include '../lib/jpgraph/jpgraph_bar.php';
     /**
      * Posts
      */
     $query = $this->db->query("\n\t\tSELECT\n\t\t    COUNT(post_id) AS posts,\n\t\t    FROM_UNIXTIME(post_time, '%b %y') AS month\n\t\tFROM {$this->pre}posts\n\t\tGROUP BY month\n\t\tORDER BY post_time");
     $data = array();
     while ($item = $this->db->nqfetch($query)) {
         $data[$item['month']] = $item['posts'];
     }
     if (!$data) {
         $data = array(0, 0);
     }
     $graph = new Graph(400, 300, 'auto');
     $graph->SetScale('textint');
     $graph->SetColor('aliceblue');
     $graph->SetMarginColor('white');
     $graph->xaxis->SetTickLabels(array_keys($data));
     $graph->yaxis->scale->SetGrace(20);
     $graph->title->Set($this->lang->stats_post_by_month);
     $barplot = new BarPlot(array_values($data));
     $barplot->SetFillColor('darkorange');
     $graph->add($barplot);
     $graph->Stroke("{$this->time}1.png");
     /**
      * Registrations
      */
     $query = $this->db->query("\n\t\tSELECT\n\t\t    COUNT(user_id) AS users,\n\t\t    FROM_UNIXTIME(user_joined, '%b %y') AS month\n\t\tFROM {$this->pre}users\n\t\tWHERE user_joined != 0\n\t\tGROUP BY month\n\t\tORDER BY user_joined");
     $data = array();
     while ($item = $this->db->nqfetch($query)) {
         $data[$item['month']] = $item['users'];
     }
     $graph = new Graph(400, 300, 'auto');
     $graph->SetScale('textint');
     $graph->SetColor('aliceblue');
     $graph->SetMarginColor('white');
     $graph->xaxis->SetTickLabels(array_keys($data));
     $graph->yaxis->scale->SetGrace(20);
     $graph->title->Set($this->lang->stats_reg_by_month);
     $barplot = new BarPlot(array_values($data));
     $barplot->SetFillColor('darkorange');
     $graph->add($barplot);
     $graph->Stroke("{$this->time}2.png");
     return $this->message($this->lang->stats, "<img src='{$this->time}1.png' alt='{$this->lang->stats_post_by_month}' /><br /><br />\n\t\t<img src='{$this->time}2.png' alt='{$this->lang->stats_reg_by_month}' />");
 }
开发者ID:BackupTheBerlios,项目名称:qsf-svn,代码行数:49,代码来源:stats.php

示例4: NetworkTable

include "../../../include/network.php";
$nt = new NetworkTable("IA_RWIS");
$cities = $nt->table;
// Create the graph. These two calls are always required
$graph = new Graph(650, 550, "example1");
$graph->SetScale("datlin");
$graph->SetMarginColor("white");
$graph->SetColor("lightyellow");
$graph->img->SetMargin(40, 55, 105, 105);
//$graph->xaxis->SetFont(FS_FONT1,FS_BOLD);
$graph->yaxis->SetTitle("Average Speed [mph]");
$graph->yaxis->title->SetFont(FF_FONT1, FS_BOLD, 12);
$graph->xaxis->SetTitle("Time Period: " . date('Y-m-d h:i A', $times[0][0]) . " thru " . date('Y-m-d h:i A', max($times[0])));
$graph->xaxis->SetTitleMargin(67);
$graph->xaxis->title->SetFont(FF_VERA, FS_BOLD, 12);
$graph->xaxis->title->SetColor("brown");
$graph->xaxis->SetPos("min");
$graph->xaxis->SetLabelAngle(90);
$graph->xaxis->SetLabelFormatString("M-j h A", true);
$graph->legend->Pos(0.01, 0.01);
$graph->legend->SetLayout(LEGEND_VERT);
$colors = array(0 => "green", 1 => "black", 2 => "blue", 3 => "red", 4 => "purple", 5 => "tan", 6 => "pink", 7 => "lavendar");
while (list($k, $v) = each($times)) {
    // Create the linear plot
    $lineplot = new LinePlot($avg_speed[$k], $times[$k]);
    $lineplot->SetLegend($labels[$k]);
    $lineplot->SetColor($colors[$k]);
    $lineplot->SetWeight(3);
    $graph->add($lineplot);
}
$graph->Stroke();
开发者ID:muthulatha,项目名称:iem,代码行数:31,代码来源:plot_traffic.php

示例5: Color

	/**
	 * 		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);
//.........这里部分代码省略.........
开发者ID:remyyounes,项目名称:dolibarr,代码行数:101,代码来源:dolgraph.class.php

示例6: getImage_p

 protected function getImage_p($id)
 {
     require_once "./protected/pages/components/velopark/artichow/Pie.class.php";
     $sql = "SELECT id, area,filling, name FROM  hr_vp_parking ";
     $cmd = $this->db->createCommand($sql);
     $data = $cmd->query();
     $data = $data->read();
     $graph = new Graph(500, 300);
     $graph->setBackgroundGradient(new LinearGradient(new White(), new VeryLightGray(40), 0));
     $graph->title->set(Prado::localize("Service {name}", array("name" => utf8_decode($data['name']))));
     $graph->shadow->setSize(3);
     $graph->shadow->smooth(TRUE);
     $graph->shadow->setPosition(Shadow::RIGHT_BOTTOM);
     $graph->shadow->setColor(new DarkGray());
     $values = array($data['filling'], $data['area'] - $data['filling'] + 1.0E-9);
     //$values = array(22.0,0.000000001);
     $colors = array(new LightRed(), new LightGreen());
     $plot = new Pie($values, $colors);
     $plot->setCenter(0.42, 0.55);
     $plot->setSize(0.7, 0.7);
     $plot->set3D(20);
     /*if($data['filling']>0)
       $plot->explode(array(1 => 10));*/
     $plot->setLegend(array(utf8_decode(Prado::localize('Used')), utf8_decode(Prado::localize('Free'))));
     $plot->legend->setPosition(1.3);
     $plot->legend->shadow->setSize(0);
     $plot->legend->setBackgroundColor(new VeryLightGray(30));
     $graph->add($plot);
     $graph->draw();
     exit;
 }
开发者ID:BackupTheBerlios,项目名称:horux-svn,代码行数:31,代码来源:status.php

示例7: color

 * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.
 *
 */
require_once "../../LinePlot.class.php";
function color($a = NULL)
{
    if ($a === NULL) {
        $a = mt_rand(20, 80);
    }
    return new Color(mt_rand(20, 180), mt_rand(20, 180), mt_rand(20, 180), $a);
}
$graph = new Graph(400, 400, "Abel", time() + 5);
$graph->setTiming(TRUE);
$graph->setAntiAliasing(TRUE);
$x = array();
for ($i = 0; $i < 10; $i++) {
    $x[] = mt_rand(0, 100);
}
$plot = new LinePlot($x);
$plot->setThickness(1);
$plot->setColor(color());
$plot->setFillGradient(new LinearGradient(color(), color(), 0));
$plot->grid->setType(LINE_DASHED);
$plot->setYMin(mt_rand(-20, 0));
$plot->yAxis->setLabelNumber(mt_rand(0, 10));
$plot->yAxis->setLabelPrecision(1);
$plot->xAxis->label->hideFirst(TRUE);
$plot->xAxis->setNumberByTick('minor', 'major', 2);
$plot->setXAxisZero((bool) mt_rand(0, 1));
$graph->add($plot);
$graph->draw();
开发者ID:BackupTheBerlios,项目名称:horux-svn,代码行数:31,代码来源:LinePlot-9.test.php

示例8: LinePlot

    }
    $trendline = new LinePlot($avg, $xdata);
    $trendline->SetWeight(2);
    $graph->AddLine($trendline);
}
//Weekends
if ($starttime > strtotime('-13 months', $endtime)) {
    for ($i = 0; $i < count($xdata); $i++) {
        $rtime = $xdata[$i];
        //get start time of this day
        $start = mktime(0, 0, 0, date('n', $rtime), date('j', $rtime), date('Y', $rtime));
        if (date('w', $rtime) == 6) {
            $end = $start + 60 * 60 * 24 * 2;
            $band = new PlotBand(VERTICAL, BAND_SOLID, $start, $end, 'lightgray@0.7');
            $band->ShowFrame(false);
            $graph->add($band);
        }
        $year = date('Y', $rtime);
        $holidays['nieuwjaarsdag'] = strtotime('1 January ' . $year);
        $holidays['nieuwjaarsdag2'] = strtotime('2 January ' . $year);
        $holidays['pasen'] = easter_date($year);
        $holidays['paasmaandag'] = strtotime('+1 day', $holidays['pasen']);
        $holidays['olhhemelvaart'] = strtotime('+39 days', $holidays['pasen']);
        $holidays['olhhemelvaart2'] = strtotime('+1day', $holidays['olhhemelvaart']);
        $holidays['pinksteren'] = strtotime('+49 days', $holidays['pasen']);
        $holidays['pinkstermaandag'] = strtotime('+1 day', $holidays['pinksteren']);
        $holidays['guldensporenslag'] = strtotime('11 July ' . $year);
        $holidays['nationale_feestdag'] = strtotime('21 July ' . $year);
        $holidays['allerheiligen'] = strtotime('1 November ' . $year);
        $holidays['allerzielen'] = strtotime('2 November ' . $year);
        $holidays['wapenstilstand'] = strtotime('11 November ' . $year);
开发者ID:nephie,项目名称:AZL-website,代码行数:31,代码来源:bedbezgraph.php

示例9: Black

		// remplacer 1.0.9 par setBorderColor
		// $pie->setBorder(new Black());
	$pie->setBorderColor(new Black());
	// mode 3D du camembert
	$pie->set3D(15);
	// couleur de fond du camembert
	//$pie->setBackgroundColor(new White(0));
	// part à séparer ?
	//$pie->explode();

// le titre
	// le texte du titre
	$pie->title->set($donnee_titre[0]);
	// emplacement du titre
	$pie->title->move(10, -20);
	// police de caractère du titre
	$pie->title->setFont(new TuffyBold(10));
	// le fond de couleur du titre
	$pie->title->setBackgroundColor(new White(50));
	// les espacement dans le cadre du titre
	$pie->title->setPadding(5, 5, 2, 2);
	// encadrement du titre
	$pie->title->border->setColor(new Black());

$graph->add($pie);

if ( $export_pdf === 'oui' ) { $graph->draw('../../documents/aa.png'); }
  else { $graph->draw(); }

?>
开发者ID:rhertzog,项目名称:lcs,代码行数:30,代码来源:graph_camembert.php

示例10: array

<?php

require "../../includes.php";
$result = array(&$count, &$date, &$product_id);
$stmt = $db->prepare_full("\n\tSELECT\n\t\tSUM(`transaction_contents`.`count`),\n\t\tDATE(`transactions`.`timestamp`) as d,\n\t\tproduct_id\n\tFROM\n\t\t`transaction_contents` JOIN\n\t\t`transactions` ON (`transaction_contents`.`transaction_id` = `transactions`.`transaction_id`)\n\tWHERE\n\t\t`transactions`.`timestamp` > ? AND\n\t\t`transaction_contents`.`product_id` in (?)\n\tGROUP BY\n\t\tDATE(`transactions`.`timestamp`), product_id\n\tORDER BY\n\t\tproduct_id,\n\t\td", $result, 'si', date('Y') - 1 . date('-m-d'), ClientData::request('id'));
$image = new Graph();
$image->slide = 7;
$image->period = 365;
$image->height = 200;
$image->width = 730;
$image->vertical_lable = 5;
$start = gregoriantojd(date('m'), date('d'), date('Y') - 1);
$old_product_id = null;
while ($stmt->fetch()) {
    if ($old_product_id != $product_id) {
        $product = Product::from_id($product_id);
    }
    $s_date = explode('-', $date);
    $image->add($count, gregoriantojd($s_date[1], $s_date[2], $s_date[0]) - $start, $product->name);
}
$image->draw();
开发者ID:nibssolutions,项目名称:Nitroxy-retail-system,代码行数:21,代码来源:product_history.php

示例11: 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

示例12: visitor_week


//.........这里部分代码省略.........
     $sTimeFrom = $oDb->quote(date("Y-m-d H:i:s", strtotime(oxRegistry::getConfig()->getRequestParameter("time_from"))));
     $sSQL = "select oxtime, count(*) as nrof from oxlogs where oxtime >= {$sTimeFrom} and oxtime <= {$sTimeTo} group by oxsessid order by oxtime";
     $aTemp = array();
     $rs = $oDb->execute($sSQL);
     if ($rs != false && $rs->recordCount() > 0) {
         while (!$rs->EOF) {
             //$aTemp[date( "W", strtotime( $rs->fields[0]))]++;
             $aTemp[oxRegistry::get("oxUtilsDate")->getWeekNumber($myConfig->getConfigParam('iFirstWeekDay'), strtotime($rs->fields[0]))]++;
             $rs->moveNext();
         }
     }
     // initializing
     list($iFrom, $iTo) = $this->getWeekRange();
     for ($i = $iFrom; $i < $iTo; $i++) {
         $aDataX[$i] = 0;
         $aDataX2[$i] = 0;
         $aDataX3[$i] = 0;
         $aDataY[] = "KW " . $i;
     }
     foreach ($aTemp as $key => $value) {
         $aDataX[$key] = $value;
         $aDataX2[$key] = 0;
         $aDataX3[$key] = 0;
         $aDataY[] = "KW " . $key;
     }
     // buyer
     $sSQL = "select oxorderdate from oxorder where oxorderdate >= {$sTimeFrom} and oxorderdate <= {$sTimeTo} order by oxorderdate";
     $aTemp = array();
     $rs = $oDb->execute($sSQL);
     if ($rs != false && $rs->recordCount() > 0) {
         while (!$rs->EOF) {
             //$aTemp[date( "W", strtotime( $rs->fields[0]))]++;
             $aTemp[oxRegistry::get("oxUtilsDate")->getWeekNumber($myConfig->getConfigParam('iFirstWeekDay'), strtotime($rs->fields[0]))]++;
             $rs->moveNext();
         }
     }
     foreach ($aTemp as $key => $value) {
         $aDataX2[$key] = $value;
     }
     // newcustomer
     $sSQL = "select oxcreate from oxuser where oxcreate >= {$sTimeFrom} and oxcreate <= {$sTimeTo} order by oxcreate";
     $aTemp = array();
     $rs = $oDb->execute($sSQL);
     if ($rs != false && $rs->recordCount() > 0) {
         while (!$rs->EOF) {
             //$aTemp[date( "W", strtotime( $rs->fields[0]))]++;
             $aTemp[oxRegistry::get("oxUtilsDate")->getWeekNumber($myConfig->getConfigParam('iFirstWeekDay'), strtotime($rs->fields[0]))]++;
             $rs->moveNext();
         }
     }
     foreach ($aTemp as $key => $value) {
         $aDataX3[$key] = $value;
     }
     header("Content-type: image/png");
     // New graph with a drop shadow
     $graph = new Graph(max(800, count($aDataX) * 80), 600);
     $graph->setBackgroundImage($myConfig->getImageDir(true) . "/reportbgrnd.jpg", BGIMG_FILLFRAME);
     // Use a "text" X-scale
     $graph->setScale("textlin");
     // Label align for X-axis
     $graph->xaxis->setLabelAlign('center', 'top', 'right');
     // Label align for Y-axis
     $graph->yaxis->setLabelAlign('right', 'bottom');
     $graph->setShadow();
     // Description
     $graph->xaxis->setTickLabels($aDataY);
     // Set title and subtitle
     $graph->title->set("Woche");
     // Use built in font
     $graph->title->setFont(FF_FONT1, FS_BOLD);
     $aDataFinalX = array();
     foreach ($aDataX as $dData) {
         $aDataFinalX[] = $dData;
     }
     // Create the bar plot
     $bplot = new BarPlot($aDataFinalX);
     $bplot->setFillGradient("navy", "lightsteelblue", GRAD_VER);
     $bplot->setLegend("Besucher");
     $aDataFinalX2 = array();
     foreach ($aDataX2 as $dData) {
         $aDataFinalX2[] = $dData;
     }
     // Create the bar plot
     $bplot2 = new BarPlot($aDataFinalX2);
     $bplot2->setFillColor("orange");
     $bplot2->setLegend("Kaeufer");
     $aDataFinalX3 = array();
     foreach ($aDataX3 as $dData) {
         $aDataFinalX3[] = $dData;
     }
     // Create the bar plot
     $bplot3 = new BarPlot($aDataFinalX3);
     $bplot3->setFillColor("silver");
     $bplot3->setLegend("Neukunden");
     // Create the grouped bar plot
     $gbplot = new groupBarPlot(array($bplot, $bplot2, $bplot3));
     $graph->add($gbplot);
     // Finally output the  image
     $graph->stroke();
 }
开发者ID:ioanok,项目名称:symfoxid,代码行数:101,代码来源:report_visitor_absolute.php

示例13: _stats_build_graph

function _stats_build_graph($data, $labels, $filename, $stat, $width, $height, $vars)
{
    if (file_exists($filename)) {
        unlink($filename);
    }
    $data_orig = $data;
    foreach ($data as $key => $val) {
        if (!is_numeric($val)) {
            $data[$key] = 0;
        }
    }
    // $vars["color_tab_black"]
    $bg_grey = _stats_color($vars["bg_grey"], 0);
    $bg_light_blue = _stats_color($vars["bg_light_blue"], 25);
    $graph = new Graph($width, $height);
    $group = new PlotGroup();
    $group->setSpace(2, 2);
    $group->grid->setType(LINE_DASHED);
    $group->grid->hideVertical(TRUE);
    $group->setPadding(30, 10, 25, 20);
    $graph->setBackgroundColor($bg_grey);
    $graph->title->set($stat);
    $graph->title->setFont(new Tuffy(10));
    $plot = new BarPlot($data, 1, 1, 0);
    $plot->setBarColor($bg_light_blue);
    $plot->label->set($data_orig);
    $plot->label->move(0, -5);
    $group->add($plot);
    $group->axis->bottom->setLabelText($labels);
    $group->axis->bottom->hideTicks(TRUE);
    $graph->add($group);
    $graph->draw($filename);
}
开发者ID:drognisep,项目名称:Simple-Groupware,代码行数:33,代码来源:preview.php

示例14: range

$xdata = range(0, $numDates - 1);
//echo "<pre>";print_r($values);print_r($xdata);echo "</pre>";
$colorIndex = 0;
foreach ($values as $currentAccountId => $currentValues) {
    $line = new LinePlot(array_values($currentValues), $xdata);
    if ($showTickMarks) {
        $line->SetCSIMTargets(array_values($valueTargets[$currentAccountId]), array_values($valueNames[$currentAccountId]));
        $line->mark->SetType(MARK_UTRIANGLE);
        $line->mark->SetColor($chartColors[$colorIndex % count($chartColors)]);
        $line->mark->SetFillColor($chartColors[$colorIndex % count($chartColors)]);
    }
    $line->SetColor($chartColors[$colorIndex % count($chartColors)]);
    $line->SetStepStyle();
    $line->SetLegend($labels[$currentAccountId]);
    $colorIndex++;
    $graph->add($line);
}
$tickLabels = array();
foreach ($totals as $key => $currentAmount) {
    $date = new Date($key);
    $tickLabels[] = $date->getFormatted();
}
if (count($values) > 1) {
    $data = array();
    $dataTargets = array();
    $dataNames = array();
    $previousAmount = null;
    foreach ($totals as $key => $currentAmount) {
        $data[] = is_null($previousAmount) || $currentAmount->compare($previousAmount) != 0 || $key == $displayEndDate->getTime() ? $currentAmount->get() : '-';
        $date = new Date($key);
        if ($showTickMarks) {
开发者ID:BackupTheBerlios,项目名称:badger-svn,代码行数:31,代码来源:trend.php

示例15: array

            $targets[$currentCategoryId][] = '';
        }
    }
}
$colorIndex = 0;
$bars = array();
foreach ($labels as $currentCategoryId => $currentLabel) {
    $bar = new BarPlot($data[$currentCategoryId]);
    $bar->SetFillColor($chartColors[$colorIndex % count($chartColors)]);
    $bar->SetLegend($labels[$currentCategoryId]);
    $bar->SetCSIMTargets($targets[$currentCategoryId], $dataNames[$currentCategoryId]);
    $bars[] = $bar;
    $colorIndex++;
}
$groupBar = new GroupBarPlot($bars);
$graph->add($groupBar);
$graph->xaxis->SetTickLabels($tickLabels);
$graph->xaxis->SetFont(FF_VERA, FS_BOLD);
$graph->xaxis->SetColor('black', 'green');
$interval = $numDatas / MAX_LABELS;
if ($interval < 1) {
    $interval = 1;
}
//echo "numDatas: $numDatas; interval: $interval";
$graph->xaxis->SetTextLabelInterval($interval);
$graph->yaxis->SetFont(FF_VERA);
$graph->legend->SetFont(FF_VERA);
$graph->legend->Pos(0.5, 0.03, 'center', 'top');
$graph->legend->SetColumns(5);
$graph->legend->SetHColMargin(10);
$graph->SetMargin(80, 20, 60, 20);
开发者ID:BackupTheBerlios,项目名称:badger-svn,代码行数:31,代码来源:timespan.php


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