5 * Copyright 2004 (c) GForge LLC
8 * @author Tim Perdue tim@gforge.org
11 * This file is part of GForge.
13 * GForge is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
18 * GForge is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
23 * You should have received a copy of the GNU General Public License
24 * along with GForge; if not, write to the Free Software
25 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28 require_once('../../env.inc.php');
29 require_once('pre.php');
30 require_once($sys_path_to_jpgraph.'/jpgraph.php');
31 require_once($sys_path_to_jpgraph.'/jpgraph_line.php');
32 require_once('common/reporting/ReportUserAdded.class.php');
42 if ($report->isError()) {
43 echo $report->getErrorMessage();
47 $group_id = getIntFromRequest('group_id');
48 $g =& group_get_object($group_id);
49 if (!$g || !is_object($g)) {
50 echo 'Permission Denied';
54 $sql="SELECT month,sum(commits) AS count
56 WHERE group_id='$group_id'
57 GROUP BY month ORDER BY month ASC";
61 $report->labels=util_result_column_to_array($res,0);
62 $report->setData($res,1);
63 $report->start_date=$report->labels[0];
64 $report->end_date=$report->labels[count($report->labels)-1];
68 // Create the graph. These two calls are always required
69 $graph = new Graph(640, 480,"auto");
70 $graph->SetMargin(50,10,35,50);
71 $graph->SetScale( "textlin");
73 // Create the linear plot
74 $lineplot =new LinePlot($report->getData());
75 $lineplot ->SetColor("black");
76 $lineplot->SetFillColor("orange");
78 // Add the plot to the graph
79 $graph->Add( $lineplot);
81 //$graph->SetMargin(10,10,25,10);
82 $graph->title->Set($g->getPublicName()." Commits Over Time: ".$report->start_date." - ".$report->end_date);
83 $graph->subtitle->Set($sys_name);
84 //$graph->xaxis-> title->Set("Date" );
85 //$graph->yaxis-> title->Set("Number" );
87 $a=$report->getDates();
88 $graph->xaxis->SetTickLabels($a);
89 $graph->xaxis->SetLabelAngle(90);
90 $graph->xaxis->SetTextLabelInterval(3);