Skip to content
Snippets Groups Projects
printer.graph.php 671 B
Newer Older
Thomas Lake's avatar
Thomas Lake committed
<?

$res = $sucsDB->Execute("select username, sum(pages) as pages from printer where username != 'old' group by username order by sum(pages) desc");
$num = $res->RecordCount();
	for ($i=0;$i<$num;$i++) {
Thomas Lake's avatar
Thomas Lake committed
		$row[$i] = $res->FetchRow();
Thomas Lake's avatar
Thomas Lake committed
		if ($i < 12)
		{
			$item[]=$row[$i]['username'];
			$slice[]=$row[$i]['pages'];
		}
		else {
			$otherSize += $row[$i]['pages'];
		}
	}
//	$itemName[]="Other";
//	$sliceSize[]=$otherSize;
Thomas Lake's avatar
Thomas Lake committed
	$slice = array_merge(array($otherSize),$slice);
	$item = array_merge(array("Other"), $item);

/*	echo "<pre>";
	print_r($slice);
	print_r($item);*/

	include("../../lib/pieChart.php");
	piechart("Top 12, Users of Printing", $slice, $item,0)