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 $gfwww.'include/pre.php';
15 require_once $gfwww.'include/graph_lib.php';
17 // require you to be a member of the sfstats group (group_id = 11084)
18 session_require( array('group'=>forge_get_config('stats_group')) );
20 $group_id = getIntFromRequest('group_id');
21 $year = getIntFromRequest('year');
28 $year = gmstrftime("%Y", time() );
31 $res = db_query_params ('SELECT month,day,new_users,new_projects FROM stats_site ORDER BY month ASC, day ASC',
35 while ( $row = db_fetch_array($res) ) {
37 $xlabel[$i] = (substr($row['month'],4) + 1 - 1) . "/" . $row['day'];
38 $ydata1[$i] = $row["new_users"];
39 $ydata2[$i] = $row["new_projects"];
43 // Need at least 2 data points
58 $xlabel[1] = $xlabel[0];
59 $ydata1[1] = $ydata1[0];
60 $ydata2[1] = $ydata2[0];
64 $graph = new Graph( 750, 550 );
66 $data1 = $graph->AddData( $xdata, $ydata1, $xlabel );
67 $data2 = $graph->AddData( $xdata, $ydata2, $xlabel );
69 $graph->DrawGrid('gray');
70 $graph->LineGraph($data1,'red');
71 $graph->LineGraph($data2,'blue');
72 $graph->SetTitle(_('New Additions, by Day') );
73 $graph->SetSubTitle(_('New Users (RED), New Projects (BLUE)'));
74 $graph->SetxTitle(_('Date'));
75 $graph->SetyTitle(_('Users (RED) / Projects (BLUE)'));
77 //$graph->showDebug();
78 $graph->ShowGraph('png');