1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113
|
<?php
/**
* Reporting System
*
* Copyright 2004 (c) GForge LLC
*
* @version $Id: trackeract_graph.php 4199 2005-03-27 21:04:58Z gsmet $
* @author Tim Perdue tim@gforge.org
* @date 2003-03-16
*
* This file is part of GForge.
*
* GForge is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* GForge is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GForge; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
require_once('pre.php');
require_once($sys_path_to_jpgraph.'/jpgraph.php');
require_once($sys_path_to_jpgraph.'/jpgraph_line.php');
require_once('common/reporting/ReportTrackerAct.class');
$SPAN = getIntFromRequest('SPAN');
$start = getIntFromRequest('start');
$end = getIntFromRequest('end');
if (!$SPAN) {
$SPAN=REPORT_TYPE_MONTHLY;
}
//
// Create Report
//
$report=new ReportTrackerAct($SPAN,$group_id,$atid,$start,$end);
//
// Check for error, such as license key problem
//
if ($report->isError()) {
echo $report->getErrorMessage();
exit;
}
//
// Get Group Object
//
$g =& group_get_object($group_id);
if (!$g || $g->isError()) {
exit_error("Could Not Get Group");
}
// Create the graph. These two calls are always required
$graph = new Graph(640, 480,"auto");
$graph->SetMargin(50,10,35,50);
$graph->SetScale( "textlin");
//$graph->SetScale( "linlog");
//$graph ->SetYScale("log");
// Create the average time plot
$ydata =& $report->getAverageTimeData();
$lineplot =new LinePlot($ydata);
$lineplot ->SetColor("black");
$graph->Add( $lineplot);
// Create the open count plot
$ydata2 =& $report->getOpenCountData();
$lineplot2 =new LinePlot($ydata2);
$lineplot2 ->SetColor("blue");
$graph->Add( $lineplot2 );
// Create the still open count plot
$ydata3 =& $report->getStillOpenCountData();
$lineplot3 =new LinePlot($ydata3);
$lineplot3 ->SetColor("red");
$graph->Add( $lineplot3 );
// Legends
$lineplot->SetLegend ("Avg Time Open");
$lineplot2 ->SetLegend("Total Opened");
$lineplot3 ->SetLegend("Total Still Open");
//echo "<pre>".print_r($report->getDates()).'<br>'.print_r($ydata).'<br>'.print_r($ydata2).'<br>'.print_r($ydata3);
//echo "<pre>".print_r($ydata2);
//exit;
//
// Titles
//
$graph->title->Set("Tracker Activity For: ".$g->getPublicName().
" (".date('m/d/Y',$report->getStartDate()) ."-". date('m/d/Y',$report->getEndDate()) .")");
$graph->subtitle->Set($report_company_name);
//$graph->xaxis-> title->Set("Date" );
//$graph->yaxis-> title->Set("Number" );
$a=$report->getDates();
$graph->xaxis->SetTickLabels($a);
$graph->xaxis->SetLabelAngle(90);
$graph->xaxis->SetTextLabelInterval($report->getGraphInterval());
// Display the graph
$graph->Stroke();
?>
|