4 * SourceForge Sitewide Statistics
6 * SourceForge: Breaking Down the Barriers to Open Source Development
7 * Copyright 1999-2001 (c) VA Linux Systems
8 * http://sourceforge.net
13 require_once('../env.inc.php');
14 require_once $gfcommon.'include/pre.php';
15 require_once $gfwww.'include/graph_lib.php';
17 session_require_global_perm ('forge_stats', 'read') ;
19 $group_id = getIntFromRequest('group_id');
20 $year = getIntFromRequest('year');
27 $year = gmstrftime("%Y", time() );
30 $res = db_query_params ('SELECT month,day,new_users,new_projects FROM stats_site ORDER BY month ASC, day ASC',
34 while ( $row = db_fetch_array($res) ) {
36 $xlabel[$i] = (substr($row['month'],4) + 1 - 1) . "/" . $row['day'];
37 $ydata1[$i] = $row["new_users"];
38 $ydata2[$i] = $row["new_projects"];
42 // Need at least 2 data points
57 $xlabel[1] = $xlabel[0];
58 $ydata1[1] = $ydata1[0];
59 $ydata2[1] = $ydata2[0];
63 $graph = new Graph( 750, 550 );
65 $data1 = $graph->AddData( $xdata, $ydata1, $xlabel );
66 $data2 = $graph->AddData( $xdata, $ydata2, $xlabel );
68 $graph->DrawGrid('gray');
69 $graph->LineGraph($data1,'red');
70 $graph->LineGraph($data2,'blue');
71 $graph->SetTitle(_('New Additions, by Day') );
72 $graph->SetSubTitle(_('New Users (RED), New Projects (BLUE)'));
73 $graph->SetxTitle(_('Date'));
74 $graph->SetyTitle(_('Users (RED) / Projects (BLUE)'));
76 //$graph->showDebug();
77 $graph->ShowGraph('png');