Below is what I have developped.
2 problems outstanding: your help would me very much appreciated.
-refering to the config file for sql connections (I removed my codes from the script

)...
-developing a setup.inc.php file to be dislayed in the menu (I do not know how to do that).
2files requiring jpgraph:
-analysis.php
-form1.php
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
ANALYSIS.PHP
<?php
$vue=$_GET['view'];
$granu=$_GET['granu'];
include ('form1.php');
include ('../jpgraph/src/jpgraph.php');
include ('../jpgraph/src/jpgraph_bar.php');
if ($granu == "week") {$echelle=7; $detail='l d/m'; $earliestdate=date('Y-m-d',strtotime('-1 week'));}
if ($granu == "month") {$echelle=31; $detail='d'; $earliestdate=date('Y-m-d',strtotime('-31 days'));}
$db = mysql_connect('sql.gtd.com', 'username', 'pass');
mysql_select_db('databasename',$db);
$i=$echelle;
while ($i>=1) {
$seuil = strtotime('+'.$i.'day', strtotime($earliestdate));
$coco=date($detail, $seuil);
$seuil=date('Y-m-d', $seuil);
$sql="SELECT count(dateCompleted) FROM `itemstatus` AS `its` WHERE its.`dateCompleted` = '$seuil' AND its.type='a'";
$req = mysql_query($sql);
$j = mysql_fetch_array($req);
$i=$i-1;
$datao1[$i]=$j[0];
$datao2[$i]=$coco;}
$i=$echelle;
while ($i>=1) {
$seuil = strtotime('+'.$i.'day', strtotime($earliestdate));
$seuil=date('Y-m-d', $seuil);
$sql="SELECT count(dateCompleted) FROM `itemstatus` AS `its` WHERE its.`dateCompleted` = '$seuil' AND its.type='p'";
$req = mysql_query($sql);
$j = mysql_fetch_array($req);
$i=$i-1;
$datao3[$i]=$j[0];}
$i=$echelle;
while ($i>=1) {
$seuil = strtotime('+'.$i.'day', strtotime($earliestdate));
$seuil=date('Y-m-d', $seuil);
$sql="SELECT count(dateCompleted) FROM `itemstatus` AS `its` WHERE its.`dateCompleted` = '$seuil' AND its.type='w'";
$req = mysql_query($sql);
$j = mysql_fetch_array($req);
$i=$i-1;
$datao4[$i]=$j[0];}
$graph=new graph(800,700);
$graph->title-> Set("COMPLETION: Rolling ".$echelle." days");
$graph->SetScale("textlin");
$graph->xaxis->SetTickLabels($datao2);
$barg = new BarPlot($datao1);
$barg->SetFillGradient("#9D9E9A","#F2F5EC",GRAD_RIGHT_REFLECTION);
$barg->SetColor("navy");
$barg->SetWidth(0.4);
$barg->SetShadow();
$barg->SetLegend("Actions");
$barh = new BarPlot($datao3);
$barh->SetFillGradient("#F36B08","#F8BD08",GRAD_RIGHT_REFLECTION);
$barh->SetColor("red");
$barh->SetWidth(0.5);
$barh->SetShadow();
$barh->SetLegend("Projects");
$bari = new BarPlot($datao4);
$bari->SetFillGradient("#46A6C1","#82E0FA",GRAD_RIGHT_REFLECTION);
$bari->SetColor("red");$bari->SetWidth(0.2);
$bari->SetShadow();
$bari->SetLegend("Waiting-ons");
$graph->legend->SetLayout(LEGEND_HOR);
$graph->legend->SetAbsPos(10,80,'right','bottom');
$graph->Add($barg);
$graph->Add($barh);
$graph->Add($bari);
$graph->img->SetImgFormat('jpeg');
$graph->Stroke('completion.jpeg');
$i=$echelle;
while ($i>=1) {
$seuil = strtotime('+'.$i.'day', strtotime($earliestdate));
$coco=date($detail, $seuil);
$seuil=date('Y-m-d', $seuil);
$sql="SELECT count(Datecreated) FROM `itemstatus` AS `its` WHERE its.`dateCreated` = '$seuil' AND its.type='a'";
$req = mysql_query($sql);
$j = mysql_fetch_array($req);
$i=$i-1;
$datar1[$i]=$j[0];
$datar2[$i]=$coco;}
$i=$echelle;
while ($i>=1) {
$seuil = strtotime('+'.$i.'day', strtotime($earliestdate));
$seuil=date('Y-m-d', $seuil);$sql="SELECT count(Datecreated) FROM `itemstatus` AS `its` WHERE its.`dateCreated` = '$seuil' AND its.type='p'";
$req = mysql_query($sql);
$j = mysql_fetch_array($req);
$i=$i-1;
$datar3[$i]=$j[0];}
$i=$echelle;
while ($i>=1) {
$seuil = strtotime('+'.$i.'day', strtotime($earliestdate));
$seuil=date('Y-m-d', $seuil);
$sql="SELECT count(Datecreated) FROM `itemstatus` AS `its` WHERE its.`dateCreated` = '$seuil' AND its.type='w'";
$req = mysql_query($sql);
$j = mysql_fetch_array($req);
$i=$i-1;
$datar4[$i]=$j[0];}
$graph=new graph(800,700);
$graph->title-> Set("CREATION: Rolling ".$echelle." days");
$graph->SetScale("textlin");
$graph->xaxis->SetTickLabels($datar2);
$barg = new BarPlot($datar1);
$barg->SetFillGradient("#9D9E9A","#F2F5EC",GRAD_RIGHT_REFLECTION);
$barg->SetColor("navy");
$barg->SetWidth(0.4);
$barg->SetShadow();
$barg->SetLegend("Actions");
$barh = new BarPlot($datar3);
$barh->SetFillGradient("#F36B08","#F8BD08",GRAD_RIGHT_REFLECTION);
$barh->SetColor("red");
$barh->SetWidth(0.5);
$barh->SetShadow();
$barh->SetLegend("Projects");
$bari = new BarPlot($datar4);
$bari->SetFillGradient("#46A6C1","#82E0FA",GRAD_RIGHT_REFLECTION);
$bari->SetColor("red");
$bari->SetWidth(0.2);
$bari->SetShadow();
$bari->SetLegend("Waiting-ons");
$graph->legend->SetLayout(LEGEND_HOR);
$graph->legend->SetAbsPos(10,80,'right','bottom');
$graph->Add($barg);
$graph->Add($barh);
$graph->Add($bari);
$graph->img->SetImgFormat('jpeg');
$graph->Stroke('creation.jpeg');
$p=0;
$echelle2=$echelle-1;
while ($p<=$echelle2) {
$datab1[$p]=$datar1[$p]-$datao1[$p];
$datab3[$p]=$datar3[$p]-$datao3[$p];
$datab4[$p]=$datar4[$p]-$datao4[$p];
$p=$p+1;}
$graph=new graph(800,700);
$graph->title-> Set("EFFICIENCY: Rolling ".$echelle." days yield");
$graph->SetScale("textlin");
$graph->xaxis->SetTickLabels($datar2);
$barg = new BarPlot($datab1);
$barg->SetFillGradient("#9D9E9A","#F2F5EC",GRAD_RIGHT_REFLECTION);
$barg->SetColor("navy");
$barg->SetWidth(0.4);
$barg->SetShadow();
$barg->SetLegend("Actions");
$barh = new BarPlot($datab3);
$barh->SetFillGradient("#F36B08","#F8BD08",GRAD_RIGHT_REFLECTION);
$barh->SetColor("red");$barh->SetWidth(0.5);$barh->SetShadow();
$barh->SetLegend("Projects");$bari = new BarPlot($datab4);
$bari->SetFillGradient("#46A6C1","#82E0FA",GRAD_RIGHT_REFLECTION);
$bari->SetColor("red");$bari->SetWidth(0.2);$bari->SetShadow();
$bari->SetLegend("Waiting-ons");//$bplot2->SetFillGradient("#46A6C1","#82E0FA",GRAD_RIGHT_REFLECTION);
$graph->legend->SetLayout(LEGEND_HOR);
$graph->legend->SetAbsPos(10,80,'right','bottom');
$graph->Add($barg);
$graph->Add($barh);
$graph->Add($bari);
$graph->img->SetImgFormat('jpeg');
$graph->Stroke('rdt.jpeg');
if ($vue != "all") {
print("<img src=\" ".$vue.".jpeg\" border=\"0\">"); }
if ($vue == "all") {
print("<img src=\"creation.jpeg\" border=\"0\">");
print("<img src=\"completion.jpeg\" border=\"0\">");
print("<img src=\"rdt.jpeg\" border=\"0\">");}
?>
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
FORM1.PHP
<div class='form' id="filter">
<form action="analysis.php" method="get">
<div class="formbuttons">
<label for="view" class='left first' title="View">Analysis for:</label>
<select name="view" id="view" title="View">
<option value="creation">Creation</option>
<option value="completion">Completion</option>
<option value="rdt">Yield</option>
<option value="all">All criteria</option>
</select>
<br>
<label for="Granularit?" class='left first' title="granu">Level of details:</label>
<select name="granu" id="granu" title="granu">
<option value="week">Week</option>
<option value="month">Month</option>
</select>
<input type="submit" id="filtersubmit" class="button" value="Filter"
name="submit" onclick="javascript:GTD.filtertoggle('all');"
title="Filter <?php echo $typename ?>s by selected criteria" />
</div>
</form>
</div>