Changeset 1084 for trunk


Ignore:
Timestamp:
2012-07-30T07:28:15+02:00 (2 years ago)
Author:
moo
Message:

htdocs/cacher: fix hits graph

Location:
trunk/htdocs/cacher
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/htdocs/cacher/cacher.css

    r1078 r1084  
    66 
    77.blocksgraph { height: 13px; } 
    8 .blocksgraph div { float: left; height: 3px; width: 4px; border: solid gray; border-width: 0 0 1px 0; } 
     8.blocksgraph div { float: left; height: 3px; width: 4px; border: 0 solid gray; border-width: 0 0 1px 0; } 
    99.blocksgraph { border: 1px solid gray; border-bottom: 0; } 
    1010.percent *, .blocksgraph *, .hitsgraph * { font-size: 1px; font-height: 1px; } 
    1111 
    1212.hitsgraph { margin: auto; } 
    13 .hitsgraph div { float: left; width: 2px; height: 100%; } 
    14 .hitsgraph div:hover { background: gray; } 
    15 .hitsgraph div div { float: none; width: 100%; } 
    16 .hitsgraph div div.barf { border: 0 solid gray; border-width: 1px 0 0 0; } 
    17 .hitsgraph div div.barv { border: 0 solid gray; border-width: 0 0 1px 0; } 
    18 .hitsgraph div div.barf.active { border-color: yellow; } 
    19 .hitsgraph div div.barv.active { border-color: yellow; } 
     13.hitsgraph a { float: left; border: 0 solid gray; } 
     14.hitsgraph a.active { border-top-color: yellow; } 
     15.hitsgraph a:hover { background: gray; } 
     16.hitsgraph a div { float: none; } 
    2017 
    2118dl { overflow: hidden; } 
  • trunk/htdocs/cacher/index.php

    r1081 r1084  
    8585    $g = $b = 220 - (int) ($percent * 220); 
    8686    $percent = (int) ($percent * 100); 
    87     $a = $active ? ' active' : ''; 
    88     $height = 20; 
     87    $a = $active ? ' class="active"' : ''; 
     88    $height = 20 - 1 * 2; 
    8989    $valueHeight = ceil($height * $percent / 100); 
    9090    $paddingHeight = $height - $valueHeight; 
    9191    $valueHeight = $valueHeight ? $valueHeight . "px" : 0; 
    9292    $paddingHeight = $paddingHeight ? $paddingHeight . "px" : 0; 
    93     return '<div title="' . $v . '">' 
    94         . '<div class="barf' . $a . '" style="height: ' . $paddingHeight . '"></div>' 
    95         . '<div class="barv' . $a . '" style="background: rgb(' . "$r,$g,$b" . '); height: ' . $valueHeight . '"></div>' 
    96         . '</div>'; 
     93    return '<a title="' . $v . '" href="javascript:;"' . $a . '>' 
     94        . ($paddingHeight ? '<div style="height: ' . $paddingHeight . '"></div>' : '') 
     95        . ($valueHeight ? '<div style="background: rgb(' . "$r,$g,$b" . '); height: ' . $valueHeight . '"></div>' : '') 
     96        . '</a>'; 
    9797} 
    9898// }}} 
     
    110110    } 
    111111    $t = (time() / (60 * 60)) % 24; 
     112 
    112113    $html = array(); 
     114    static $cssOut = false; 
     115    if (!$cssOut) { 
     116        $cssOut = true; 
     117        $html[] = '<style type="text/css">'; 
     118        $html[] = '.hitsgraph a { width: 2px; height: 20px; border-top-width: 1px; border-bottom-width: 1px; }'; 
     119        $html[] = '</style>'; 
     120    } 
     121 
     122    $width = count($ci[$key]) * 2; 
     123    $html[] = '<div class="hitsgraph" style="width: ' . $width . 'px">'; 
    113124    foreach ($ci[$key] as $i => $v) { 
    114125        $html[] = bar_hits_percent($v, $v / $max, $i == $t); 
    115126    } 
     127    $html[] = "</div>"; 
    116128    return implode('', $html); 
    117129} 
  • trunk/htdocs/cacher/sub/summary.tpl.php

    r1078 r1084  
    6767        $hits_avg_s     = number_format(array_avg($ci['hits_by_second']), 2); 
    6868        $hits_graph_h   = get_cache_hits_graph($ci, 'hits_by_hour'); 
    69         $hits_graph_h_w = count($ci['hits_by_hour']) * 2; 
    7069 
    7170        if (!empty($ci['istotal'])) { 
     
    113112        <td>{$ci['status']}</td> 
    114113        <td align="right">{$ci['hits']}</td> 
    115         <td><div class="hitsgraph" style="width: {$hits_graph_h_w}px">{$hits_graph_h}</div></td> 
     114        <td>{$hits_graph_h}</td> 
    116115        <td align="right">{$hits_avg_h}</td> 
    117116        <td align="right">{$hits_avg_s}</td> 
Note: See TracChangeset for help on using the changeset viewer.