function yearly()
{
    include 'opendb.php';
    include 'libchart/libchart.php';
    header("Content-type: image/png");
    $chart = new VerticalChart(680, 500);
    $sql = "SELECT count(AcctStartTime), YEAR(AcctStartTime) AS Year from " . $configValues['CONFIG_DB_TBL_RADACCT'] . " group by Year;";
    $res = $dbSocket->query($sql);
    while ($row = $res->fetchRow()) {
        $chart->addPoint(new Point("{$row['1']}", "{$row['0']}"));
    }
    $chart->setTitle("Distribución de ingresos por año");
    $chart->render();
    include 'closedb.php';
}
function yearly($username)
{
    include 'opendb.php';
    include 'libchart/libchart.php';
    $username = $dbSocket->escapeSimple($username);
    header("Content-type: image/png");
    $chart = new VerticalChart(680, 500);
    $sql = "SELECT UserName, count(AcctStartTime), YEAR(AcctStartTime) AS Year FROM " . $configValues['CONFIG_DB_TBL_RADACCT'] . " WHERE username='******' GROUP BY Year;";
    $res = $dbSocket->query($sql);
    while ($row = $res->fetchRow()) {
        $chart->addPoint(new Point("{$row['2']}", "{$row['1']}"));
    }
    $chart->setTitle("Total Users");
    $chart->render();
    include 'closedb.php';
}
function yearly($username)
{
    include 'opendb.php';
    include 'libchart/libchart.php';
    $username = $dbSocket->escapeSimple($username);
    header("Content-type: image/png");
    $chart = new VerticalChart(680, 500);
    $sql = "SELECT UserName, sum(AcctInputOctets) as Uploads, year(AcctStartTime) AS year FROM " . $configValues['CONFIG_DB_TBL_RADACCT'] . " WHERE username='******' GROUP BY year;";
    $res = $dbSocket->query($sql);
    while ($row = $res->fetchRow()) {
        $uploads = floor($row[1] / 1024 / 1024);
        $chart->addPoint(new Point("{$row['2']}", "{$uploads}"));
    }
    $chart->setTitle("Total Uploads based on Yearly distribution");
    $chart->render();
    include 'closedb.php';
}
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 *
 *********************************************************************************************************
 * Description:
 *              this extension creates a pie chart of new users
 *
 * Authors:     Liran Tal <*****@*****.**>
 *              Filippo Maria Del Prete <*****@*****.**>
 *
 *********************************************************************************************************
 */
include 'checklogin.php';
if (isset($_GET['startdate'])) {
    $startdate = $_GET['startdate'];
}
if (isset($_GET['enddate'])) {
    $enddate = $_GET['enddate'];
}
include 'opendb.php';
include 'libchart/libchart.php';
header("Content-type: image/png");
$chart = new VerticalChart(680, 500);
$sql = "SELECT COUNT(*), CONCAT(YEAR(Creationdate),'-',MONTH(Creationdate), '-01') AS Month from " . $configValues['CONFIG_DB_TBL_DALOUSERINFO'] . " WHERE CreationDate >='{$startdate}' AND CreationDate <='{$enddate}' " . " GROUP BY Month ORDER BY Date(Month);";
$res = $dbSocket->query($sql);
while ($row = $res->fetchRow()) {
    $chart->addPoint(new Point("{$row['1']}", "{$row['0']}"));
}
$chart->setTitle("New Users by Month");
$chart->render();
include 'closedb.php';
function yearly()
{
    global $sizeDivision;
    global $size;
    include 'opendb.php';
    include 'libchart/libchart.php';
    header("Content-type: image/png");
    $chart = new VerticalChart(680, 500);
    $sql = "SELECT sum(AcctOutputOctets) as Downloads, year(AcctStartTime) AS year from " . $configValues['CONFIG_DB_TBL_RADACCT'] . " group by year;";
    $res = $dbSocket->query($sql);
    while ($row = $res->fetchRow()) {
        $downloads = floor($row[0] / $sizeDivision);
        $chart->addPoint(new Point("{$row['1']}", "{$downloads}"));
    }
    $chart->setTitle("Distribución de volumen de trafico total anual ({$size})");
    $chart->render();
    include 'closedb.php';
}
예제 #6
0
function graph_month($month, $year)
{
    include 'opendb.php';
    include 'libchart/libchart.php';
    header("Content-type: image/png");
    $chart = new VerticalChart(780, 500);
    $month = month_alpha_to_number($month);
    $lastDay = date("d", mktime(0, 0, 0, $month + 1, 0, date("Y")));
    for ($i = 1; $i <= $lastDay; $i++) {
        $measure[$i]['min'] = 100000;
        $measure[$i]['max'] = 0;
        for ($j = 0; $j < 24; $j++) {
            //24 hours a day
            $date = "{$year}-{$month}-{$i} {$j}:00:00";
            $sql = "select count(radacctid) from radacct where (acctstarttime <= '{$date}' and acctstoptime >= '{$date}') or (acctstarttime <= '{$date}' and acctsessiontime = 0 and acctinputoctets = 0 and acctoutputoctets = 0);";
            $result = $dbSocket->query($sql);
            $row = $result->fetchRow();
            $cnt = $row[0];
            if ($cnt < $measure[$i]['min']) {
                $measure[$i]['min'] = $cnt;
            } else {
                if ($cnt > $measure[$i]['max']) {
                    $measure[$i]['max'] = $cnt;
                }
            }
        }
    }
    for ($i = 1; $i <= $lastDay; $i++) {
        $chart->addPoint(new Point("{$i} - Min", $measure[$i]['min']));
        $chart->addPoint(new Point("{$i} - Max", $measure[$i]['max']));
    }
    $chart->setTitle("Logged users by month");
    $chart->render();
    include 'closedb.php';
}
예제 #7
0
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 * 
 */
/**
 * Vertical bars demonstration
 *
 */
include "../libchart.php";
$chart = new VerticalChart();
$chart->addPoint(new Point("Jan 2005", 273));
$chart->addPoint(new Point("Feb 2005", 421));
$chart->addPoint(new Point("March 2005", 642));
$chart->addPoint(new Point("April 2005", 800));
$chart->addPoint(new Point("May 2005", 1200));
$chart->addPoint(new Point("June 2005", 1500));
$chart->addPoint(new Point("July 2005", 2600));
$chart->setTitle("Monthly usage for www.example.com");
$chart->render("generated/demo1.png");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title>Libcharts vertical bars demonstration</title>
	<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-15" />
</head>
<body>
	<img alt="Vertical bars chart" src="generated/demo1.png" style="border: 1px solid gray;"/>
</body>
</html>
function yearly($username)
{
    global $sizeDivision;
    global $size;
    include 'opendb.php';
    include 'libchart/libchart.php';
    $username = $dbSocket->escapeSimple($username);
    header("Content-type: image/png");
    $chart = new VerticalChart(680, 500);
    $sql = "SELECT UserName, sum(AcctOutputOctets) as Downloads, year(AcctStartTime) AS year FROM " . $configValues['CONFIG_DB_TBL_RADACCT'] . " WHERE username='******' GROUP BY year;";
    $res = $dbSocket->query($sql);
    while ($row = $res->fetchRow()) {
        $downloads = $downloads = number_format($row[1] / $sizeDivision, 2, '.', '');
        $chart->addPoint(new Point("{$row['2']}", "{$downloads}"));
    }
    $chart->setTitle("Distribución de la descarga total por año ({$size})");
    $chart->render();
    include 'closedb.php';
}