Browse Source

show hits for each hits graph column

git-svn-id: svn://svn.lighttpd.net/xcache/trunk@538 c26eb9a1-5813-0410-bd6c-c2e55f420ca7
3.0
Xuefer 14 years ago
parent
commit
041eb98dea
  1. 1
      admin/xcache.css
  2. 6
      admin/xcache.php

1
admin/xcache.css

@ -30,6 +30,7 @@ form {margin: 0; padding: 0}
.hitsgraph { height: 20px; margin: auto; }
.hitsgraph div { float: left; width: 2px; height: 100%; }
.hitsgraph div:hover { background: gray; }
.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; }

6
admin/xcache.php

@ -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);
}

Loading…
Cancel
Save