Location: PHPKode > projects > MyPBS > mypbs/frontend/clustergraph.php
<?php
# MyPBS is a PHP/MySQL/Perl frontend accounting package for the
# Portable Batch System (PBS). It has advanced features such as
# projects, service-unit weights, per-user project permissions,
# and much more.

# Copyright (C) 2004 Created By:
#               UMaine-Advanced Computing Research Laboratory
#               http://www.clusters.umaine.edu
#               Developers:
#               Glen Beane <hide@address.com>
#               Eric Wages <hide@address.com>
#               Christopher Vaughan <hide@address.com>
#               Tristan McCann <hide@address.com>
#

# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,
# USA.

Header('Content-Type: image/png');
include_once("./panachart.php");

session_start ();

$history = $_SESSION[history];

$this_month = date ("n");
if ($this_month == 12) {                #December is the only month that we get only the current year.
	$first_month = 1;
} else {
	$first_month = $this_month + 1;
}

$temp_month = $first_month;
$temp_year = $first_year;
for ($i = 0; $i < 12; $i++) {
	$timestamp = mktime (0,0,0,$temp_month, 1, $temp_year);
	$month_array[$i] = date('M', $timestamp);
	$temp_month++;
	if ($temp_month > 12) {
		$temp_month = 1;
	}
}


$graph = new chart(450,195,7,'#959595');//border
$graph->setTitle("Service Units, Previous 12 months", "#ffffff",2);//name of chart
$graph->setPlotArea(SOLID,"", '#eeffff'); //middle background
$graph->setFormat(2,',','.');
$graph->addSeries($history,'bar','Series1',SOLID,'#606060','#ff652b'); //bars
$graph->setXAxis('#000000',SOLID,1,"");  //lines that border the graph
$graph->setYAxis('#000000',SOLID,1,"");  //lines that border the graph
$graph->setLabels($month_array, '#ffffff', 1, HORIZONTAL); //labels
$graph->setGrid("#959595", DASHED,"",DOTTED);  //dashed lines
$graph->plot('');

if ($_GET[logout] == 1) {
  session_destroy ();
}

?>
Return current item: MyPBS