Commit 10caf7d1 authored by Paul Asmuth's avatar Paul Asmuth
Browse files

toplist gauge: display trends

parent 075917cd
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -44,9 +44,8 @@ BACKLOG


  > Toplist Gauge
    - trending tab / display trends
    - display rank
    - compare tab
    - tabs: compare, trends

 
  > Timeseries Gauge
+9 −1
Original line number Diff line number Diff line
@@ -32,4 +32,12 @@ class FnordMetric::Toplist
    (@toplist[item].to_f / total.to_f) * 100.0
  end

  def trend(item)
    times = @timelines[item].keys.sort
    
    ((@timelines[item][times.last] - 
      @timelines[item][times.first]) /
      @timelines[item][times.first])
  end

end
 No newline at end of file
+14 −1
Original line number Diff line number Diff line
@@ -229,7 +229,8 @@ color:#000;
.ui_toplist .toplist_item:hover{ background:#fff; }
.ui_toplist .toplist_item .title{ float:left; line-height:42px; margin-left:20px; font-size:13px; color:#333; }
.ui_toplist .toplist_item .value{ float:right; line-height:42px; margin-right:20px; font-size:13px; font-weight:bold; color:#333; width:70px; color:#666; }
.ui_toplist .toplist_item .percent{ float:right; line-height:42px; margin-right:20px; font-size:18px; font-weight:bold; color:#333; width:70px; }
.ui_toplist .toplist_item .percent{ float:right; line-height:42px; margin-right:30px; font-size:18px; font-weight:bold; color:#333; width:110px; white-space:nowrap; }
.ui_toplist .toplist_item .ui_trend{ margin-top:10px; }

.ui_toplist .searchbar{ background:#efefef; border-bottom: 1px solid #DDD; padding:10px 17px; }
.ui_toplist.clickable .toplist_item:hover{ background:#efefef; cursor:pointer; }
@@ -640,3 +641,15 @@ margin-top: 60px;
  width:auto;
  margin-top:26px;
}


.ui_trend{
  float:right;
  font-size:11px;
  font-weight:bold;
  background:rgba(255,255,255,0.9);
  height:22px;
  line-height:23px;  
  padding:0 5px;
  border-radius:3px;
}
+5 −1
Original line number Diff line number Diff line
@@ -24,7 +24,9 @@
        .toplist_item(onclick="toplgaugeSelectItem.apply(this); return false;" data-item="#{item}")
          .title= item
          .value= score
          .percent= @toplist.percentage(item).round(1).to_s + "%"
          .percent
            = @toplist.percentage(item).round(1).to_s + "%"
            %span.ui_trend{ :"data-trend" => @toplist.trend(item).round(1) }


  .widget_keystats.resize_full_height.resizable(data-width="45")
@@ -53,6 +55,8 @@
:gaugejs

  FnordMetric.util.updateNumbers('.report_view', 4);

  FnordMetric.ui.trends('.report_view');
  FnordMetric.ui.resizable('#viewport');

  FnordMetric.widgets.timeseriesWidget().render({
+32 −1
Original line number Diff line number Diff line
@@ -74,3 +74,34 @@ FnordMetric.ui.resizable = function(elem){
    $(this).width(wwidth);
  });
}

FnordMetric.ui.trends = function(elem){
  $('.ui_trend', $(elem)).each(function(){
    var delta = parseFloat($(this).attr('data-trend'));
    var deg   = 0;

    if(delta > 0){
      $(this).css('color', '#2B2');  
      $(this).html('+' + delta);
      deg = -45;
    } else if (delta < 0){
      $(this).css('color', '#B22');  
      $(this).html(delta);
      deg = 45; 
    } else {
      $(this).css('color', '#555');  
      $(this).html(delta);
    }

    $(this).append(
      $('<i class="icon icon-arrow-right">').css({
        'marginLeft': '3px',
        'display': 'block',
        'font-size': '10px',
        'float': 'right',
        '-webkit-transform': 'rotate('+deg+'deg)',
        '-moz-transform': 'rotate('+deg+'deg)'
      })
    )
  });
}
+33 −33

File changed.

Contains only whitespace changes.

Loading