This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
phptsmadmin/htdocs/image.occupancy.php

38 lines
1.1 KiB
PHP
Raw Permalink Normal View History

2011-01-13 14:45:19 +00:00
<?php
// $Header: /cvsroot/phptsmadmin/phpTSMadmin/htdocs/image.occupancy.php,v 1.8 2009/04/19 03:54:40 wurley Exp $
# Required Libraries
require './common.php';
initJPGraph(true);
if (! isset($_SESSION['graph']['occupancy']))
exit;
ksort($_SESSION['graph']['occupancy']);
$num = count($_SESSION['graph']['occupancy'])-10;
if ($num < 0)
$num = 0;
$graph = new PieGraph(400,200+20*$num,'auto');
$plot = new PiePlot(array_values($_SESSION['graph']['occupancy']));
$plot->SetLegends(array_keys($_SESSION['graph']['occupancy']));
# It seems the guide lines break the grpah if there are large number of points.
//$plot->SetGuideLines(false,false);
//$plot->SetGuideLinesAdjust(1.0);
$plot->value->SetFormat('%2.1f%%');
$plot->SetCenter(200,100);
$plot->SetSize(60);
$plot->SetTheme('sand');
$graph->Add($plot);
$graph->legend->SetFillColor('azure');
$graph->SetMarginColor('azure2');
$graph->title->Set(sprintf('Storage Used by Last Access for %s',$app['server']->GetStatusDetail('SERVER_NAME')));
# Display the chart
unset($_SESSION['graph']['occupancy']);
$graph->Stroke();
?>