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/ReportUserAdded.class.php';
41 if ($report->isError()) {
42 echo $report->getErrorMessage();
46 $group_id = getIntFromRequest('group_id');
47 $g =& group_get_object($group_id);
48 if (!$g || !is_object($g)) {
49 echo 'Permission Denied';
53 $res = db_query_params ('SELECT month,sum(commits) AS count
56 GROUP BY month ORDER BY month ASC',
60 $report->labels=util_result_column_to_array($res,0);
61 $report->setData($res,1);
62 $report->start_date=$report->labels[0];
63 $report->end_date=$report->labels[count($report->labels)-1];
67 // Create the graph. These two calls are always required
68 $graph = new Graph(640, 480,"auto");
69 $graph->SetMargin(50,10,35,50);
70 $graph->SetScale( "textlin");
72 // Create the linear plot
73 $lineplot =new LinePlot($report->getData());
74 $lineplot ->SetColor("black");
75 $lineplot->SetFillColor("orange");
77 // Add the plot to the graph
78 $graph->Add( $lineplot);
80 //$graph->SetMargin(10,10,25,10);
81 $graph->title->Set($g->getPublicName()." Commits Over Time: ".$report->start_date." - ".$report->end_date);
82 $graph->subtitle->Set($sys_name);
83 //$graph->xaxis-> title->Set("Date" );
84 //$graph->yaxis-> title->Set("Number" );
86 $a=$report->getDates();
87 $graph->xaxis->SetTickLabels($a);
88 $graph->xaxis->SetLabelAngle(90);
89 $graph->xaxis->SetTextLabelInterval(3);