mark current hour in hits graph
git-svn-id: svn://svn.lighttpd.net/xcache/trunk@535 c26eb9a1-5813-0410-bd6c-c2e55f420ca73.0
parent
025a73977b
commit
6b79b66eb6
|
@ -28,9 +28,13 @@ form {margin: 0; padding: 0}
|
|||
.blocksgraph div { float: left; height: 3px; width: 4px; border: solid gray; border-width: 0 0px 1px 0; }
|
||||
.blocksgraph { border: 1px solid gray; border-bottom: 0px; }
|
||||
|
||||
.hitsgraph { height: 20px; border: solid gray; border-width: 1px 0 1px 0; margin: auto; }
|
||||
.hitsgraph { height: 20px; margin: auto; }
|
||||
.hitsgraph div { float: left; width: 2px; height: 100%; }
|
||||
.bitsgraph div div { float: none; width: 100%; }
|
||||
.hitsgraph div div { float: none; width: 100%; }
|
||||
.hitsgraph div div.barf { border: 0px solid gray; border-width: 1px 0 0 0; }
|
||||
.hitsgraph div div.barv { border: 0px solid gray; border-width: 0 0 1px 0; }
|
||||
.hitsgraph div div.barf.active { border-color: yellow; }
|
||||
.hitsgraph div div.barv.active { border-color: yellow; }
|
||||
|
||||
.switcher, h1 { text-align: center; display: block; }
|
||||
.switcher * { color: blue; }
|
||||
|
|
|
@ -151,14 +151,15 @@ function array_avg($a)
|
|||
return array_sum($a) / count($a);
|
||||
}
|
||||
|
||||
function bar_percent($percent)
|
||||
function bar_percent($percent, $active)
|
||||
{
|
||||
$r = 220 + (int) ($percent * 25);
|
||||
$g = $b = 220 - (int) ($percent * 220);
|
||||
$percent = (int) ($percent * 100);
|
||||
$a = $active ? ' active' : '';
|
||||
return '<div>'
|
||||
. '<div style="height: ' . (100 - $percent) . '%"></div>'
|
||||
. '<div style="background: rgb(' . "$r,$g,$b" . '); height: ' . $percent . '%"></div>'
|
||||
. '<div class="barf' . $a . '" style="height: ' . (100 - $percent) . '%"></div>'
|
||||
. '<div class="barv' . $a . '" style="background: rgb(' . "$r,$g,$b" . '); height: ' . $percent . '%"></div>'
|
||||
. '</div>';
|
||||
}
|
||||
|
||||
|
@ -173,9 +174,10 @@ function hits_to_graph($hits)
|
|||
if (!$max) {
|
||||
return '';
|
||||
}
|
||||
$t = (time() / (60 * 60)) % 24;
|
||||
$html = array();
|
||||
foreach ($hits as $v) {
|
||||
$html[] = bar_percent($v / $max);
|
||||
foreach ($hits as $i => $v) {
|
||||
$html[] = bar_percent($v / $max, $i == $t);
|
||||
}
|
||||
return implode('', $html);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue