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