<?php include "../lib/jpgraph/jpgraph.php"; include "../lib/jpgraph/jpgraph_bar.php"; include "../lib/jpgraph/jpgraph_date.php"; include "../modules/statistics.php"; try { $stat = new CostsStatistics(); $data = $stat->getCostsStats('4w'); } 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]); } //print_r($datax); //print_r($datay); //$datay=array(12,8,19,3,10,5); // Create the graph. These two calls are always required $graph = new Graph(700, 350, 'auto'); $graph->SetScale("texlin"); $graph->yaxis->scale->SetGrace(10); $graph->xaxis->SetTickLabels($datax); $graph->xaxis->SetLabelAngle(45); $graph->xaxis->SetTextLabelInterval(5); // Add a drop shadow $graph->SetShadow();
// content="text/plain; charset=utf-8" 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->getCostsStats($period); } catch (StatisticException $e) { echo "Error generating statistic: {$e}"; } $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); $graph->xaxis->SetTickLabels($datax);