Skip to content

Commit

Permalink
Fixes: 0001238: wrong jpgraph for records with no submitdate
Browse files Browse the repository at this point in the history
  This fixes the issue of different values between the table data and the pie chart, now, the number of non completed are presented.

git-svn-id: file:///Users/Shitiz/Downloads/lssvn/source/stable_plus@3426 b72ed6b6-b9f8-46b5-92b4-906544132732
  • Loading branch information
Gustavo San Roman committed Oct 19, 2007
1 parent 6db1eb2 commit b644889
Showing 1 changed file with 39 additions and 2 deletions.
41 changes: 39 additions & 2 deletions admin/statistics.php
Expand Up @@ -1358,6 +1358,7 @@ function show(element) {
."\t\t<td width='25%' align='center' >"
."<strong>".$clang->gT("Percentage")."</strong></td>\n"
."\t</tr>\n";
$TotalCompleted = 0; // this will count the asnwers considered completed
foreach ($alist as $al)
{
if (isset($al[2]) && $al[2]) //picks out alist that come from the multiple list above
Expand Down Expand Up @@ -1403,6 +1404,7 @@ function show(element) {
// $statisticsoutput .= "\n<!-- ($sql): $query -->\n\n";
while ($row=$result->FetchRow())
{
$TotalCompleted += $row[0];
if ($al[0] == "")
{$fname=$clang->gT("No answer");}
elseif ($al[0] == $clang->gT("Other") || $al[0] == "Answers")
Expand Down Expand Up @@ -1442,6 +1444,29 @@ function show(element) {
$lbl[] = wordwrap($label, 20, "\n");
}
}
if (incompleteAnsFilterstate() === false)
{
$TotalIncomplete = $results - $TotalCompleted;
$fname=$clang->gT("Non completed");
$statisticsoutput .= "\t<tr>\n\t\t<td width='50%' align='center' >"
."$fname\n"
."\t\t</td>\n"
."\t\t<td width='25%' align='center' >$TotalIncomplete\n";
if ($results > 0) {$vp=sprintf("%01.2f", ($TotalIncomplete/$results)*100)."%";} else {$vp="N/A";}
$statisticsoutput .= "\t\t</td><td width='25%' align='center' >$vp"
."\t\t</td>\n\t</tr>\n";
if ($results > 0)
{
$gdata[] = ($TotalIncomplete/$results)*100;
} else
{
$gdata[] = 0;
}
$grawdata[]=$TotalIncomplete;
$label=strip_tags($fname);
$justcode[]=$fname;
$lbl[] = wordwrap($label, 20, "\n");
}

if ($usejpgraph == 1 && array_sum($gdata)>0) //JPGRAPH CODING ORIGINALLY SUBMITTED BY Pieterjan Heyse
{
Expand Down Expand Up @@ -1494,8 +1519,7 @@ function show(element) {
$graph->legend->SetFont(constant($jpgraphfont), FS_NORMAL, $fontsize);
$graph->legend->SetPos(0.015, $legendtop, 'right', 'top');
$graph->legend->SetFillColor("white");
$graph->SetAntiAliasing();

// $graph->SetAntiAliasing();
}
$graph->title->SetColor("#EEEEEE");
$graph->SetMarginColor("#FFFFFF");
Expand All @@ -1515,6 +1539,19 @@ function show(element) {
$p1->value->SetFont(constant($jpgraphfont),FS_BOLD,8);
$p1->value->SetColor("#FFFFFF");
} else { //Pie Chart
// this block is to remove the items with value == 0
$i = 0;
while (isset ($gdata[$i]))
{
if ($gdata[$i] == 0)
{
array_splice ($gdata, $i, 1);
array_splice ($lbl, $i, 1);
}
else
{$i++;}
}

$p1 = new PiePlot3d($gdata);
// $statisticsoutput .= "<pre>";print_r($lbl);$statisticsoutput .= "</pre>";
// $statisticsoutput .= "<pre>";print_r($gdata);$statisticsoutput .= "</pre>";
Expand Down

0 comments on commit b644889

Please sign in to comment.