|
|
|
@ -151,13 +151,13 @@ function array_avg($a)
|
|
|
|
|
return array_sum($a) / count($a);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function bar_percent($percent, $active)
|
|
|
|
|
function bar_hits_percent($v, $percent, $active)
|
|
|
|
|
{
|
|
|
|
|
$r = 220 + (int) ($percent * 25);
|
|
|
|
|
$g = $b = 220 - (int) ($percent * 220);
|
|
|
|
|
$percent = (int) ($percent * 100);
|
|
|
|
|
$a = $active ? ' active' : '';
|
|
|
|
|
return '<div>'
|
|
|
|
|
return '<div title="' . $v . '">'
|
|
|
|
|
. '<div class="barf' . $a . '" style="height: ' . (100 - $percent) . '%"></div>'
|
|
|
|
|
. '<div class="barv' . $a . '" style="background: rgb(' . "$r,$g,$b" . '); height: ' . $percent . '%"></div>'
|
|
|
|
|
. '</div>';
|
|
|
|
@ -177,7 +177,7 @@ function hits_to_graph($hits)
|
|
|
|
|
$t = (time() / (60 * 60)) % 24;
|
|
|
|
|
$html = array();
|
|
|
|
|
foreach ($hits as $i => $v) {
|
|
|
|
|
$html[] = bar_percent($v / $max, $i == $t);
|
|
|
|
|
$html[] = bar_hits_percent($v, $v / $max, $i == $t);
|
|
|
|
|
}
|
|
|
|
|
return implode('', $html);
|
|
|
|
|
}
|
|
|
|
|