<?php include "../lib/jpgraph/jpgraph.php"; include "../lib/jpgraph/jpgraph_bar.php"; include "../lib/jpgraph/jpgraph_date.php"; require '../modules/statistics.php'; require_once '../modules/access_manager.php'; $access = new AccessManager(); $filename = basename($_SERVER['PHP_SELF']); if ($filename != "login.php") { $access->checkAuth(); } $period = $_GET['p']; try { $stat = new CostsStatistics(); $data = $stat->getCreditsStats($period); } catch (StatisticException $e) { echo "Error generating statistic: {$e}"; exit; } $datax = array(); $datay = array(); foreach ($data as $entry) { array_push($datax, $entry[0]); array_push($datay, $entry[1]); } $tickint = count($datax) > 1 && count($datax) < 5 ? 5 : 2; // Create the graph. These two calls are always required $graph = new Graph(700, 350, 'auto'); $graph->SetScale("texlin"); $graph->yaxis->scale->SetGrace(10);