Hi, this patch alters the percentages shown in the stats.php3 page. Now the values are percentages of the total. Also the color value is changed so the bars have more contrast to the background.
Uli [EMAIL PROTECTED] htdocs]$ diff -u stats.php3 stats.new_perc.php3 --- stats.php3 2003-08-28 15:01:59.000000000 +0200 +++ stats.new_perc.php3 2003-11-10 14:34:15.000000000 +0100 @@ -132,6 +132,10 @@ $data['avg'][2] = ceil($data['sum'][2] / $num[2]); $data['avg'][3] = ceil($data['sum'][3] / $num[3]); +$data['raw'][1] = $data['sum'][1]; +$data['raw'][2] = $data['sum'][2]; +$data['raw'][3] = $data['sum'][3]; + $data['avg'][1] = $fun[$column[1]]($data['avg'][1]); $data['avg'][2] = $fun[$column[2]]($data['avg'][2]); $data['avg'][3] = $fun[$column[3]]($data['avg'][3]); @@ -151,12 +155,13 @@ $day = "$days[$i]"; for ($j = 1; $j <= 3; $j++){ $tmp = $data[$day][$j]; - if (!$max[$j]) + if (!$max[$j] || $data['sum'][$j] == 0) $p = $w = $c = 0; else{ - $p = floor(100 * ($tmp / $max[$j])); - $w = floor(70 * ($tmp / $max[$j])); - $c = hexdec('f0e9e2') - (258 * $p); + $delta = 0.000001; + $p = round((100 * ($tmp / $data['raw'][$j])) + $delta); + $w = round((70 * ($tmp / $data['raw'][$j])) + $delta); + $c = hexdec('f0b9b2') - (258 * $p); $c = dechex($c); } if (!$w)
--- stats.php3 2003-08-28 15:01:59.000000000 +0200 +++ stats.new_perc.php3 2003-11-10 14:34:15.000000000 +0100 @@ -132,6 +132,10 @@ $data['avg'][2] = ceil($data['sum'][2] / $num[2]); $data['avg'][3] = ceil($data['sum'][3] / $num[3]); +$data['raw'][1] = $data['sum'][1]; +$data['raw'][2] = $data['sum'][2]; +$data['raw'][3] = $data['sum'][3]; + $data['avg'][1] = $fun[$column[1]]($data['avg'][1]); $data['avg'][2] = $fun[$column[2]]($data['avg'][2]); $data['avg'][3] = $fun[$column[3]]($data['avg'][3]); @@ -151,12 +155,13 @@ $day = "$days[$i]"; for ($j = 1; $j <= 3; $j++){ $tmp = $data[$day][$j]; - if (!$max[$j]) + if (!$max[$j] || $data['sum'][$j] == 0) $p = $w = $c = 0; else{ - $p = floor(100 * ($tmp / $max[$j])); - $w = floor(70 * ($tmp / $max[$j])); - $c = hexdec('f0e9e2') - (258 * $p); + $delta = 0.000001; + $p = round((100 * ($tmp / $data['raw'][$j])) + $delta); + $w = round((70 * ($tmp / $data['raw'][$j])) + $delta); + $c = hexdec('f0b9b2') - (258 * $p); $c = dechex($c); } if (!$w)