Commit 7fda5720 authored by Paul Asmuth's avatar Paul Asmuth
Browse files

proper value formatting

parent 9a04885b
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -229,6 +229,7 @@ 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 .value.large{ width:110px; }
.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 .trend{ float:right; line-height:42px; margin-right:30px; font-size:18px; font-weight:bold; color:#333; width:70px; white-space:nowrap; }
+10 −6
Original line number Diff line number Diff line
@@ -15,9 +15,9 @@



  .widget_toplist.ui_sidebar_toplist.resizable.resize_min_full_height(data-width="55")
  .ui_sidebar_toplist.resizable.resize_min_full_height(data-width="55")
    
    .toplgauge_tab.overview
    .widget_toplist.toplgauge_tab.overview
      .headbar
        %h2 Top #{key_nouns.last}
      .ui_toplist.clickable
@@ -27,9 +27,10 @@
        - @toplist.toplist(top_k).each_with_index do |(item, score), ind|
          .toplist_item(onclick="toplgaugeSelectItem.apply(this); return false;" data-item="#{item}" style="#{ind > 49 ? 'display:none;' : nil}" class="#{ind > 49 ? nil : :initial}")
            .title= item
            .value= score
            .value
              %span.ui_value{:"data-value" => score }
            .percent
              = @toplist.percentage(item).round(1).to_s + "%"
              %span.ui_value{:"data-percent" => @toplist.percentage(item).round(1) }
              %span.ui_trend{ :"data-trend" => @toplist.trend(item).round(1) }
              

@@ -40,7 +41,10 @@
      .ui_toplist.clickable
        .toplist_item(onclick="toplgaugeSelectItem.apply(this); return false;" data-item="stoff")
          .title stoff
          .value= @toplist.value("stoff").to_s + " / " + @toplist.percentage("stoff").round(1).to_s + "%"
          .value.large
            %span.ui_value{:"data-value" => @toplist.value("stoff") }
            = " / "
            %span.ui_value{:"data-percent" => @toplist.percentage("stoff").round(1) }

          .trend
            %span.ui_trend(data-trend="2.3")
@@ -71,7 +75,7 @@

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

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


+52 −26
Original line number Diff line number Diff line
@@ -75,8 +75,31 @@ FnordMetric.ui.resizable = function(elem){
  });
}

FnordMetric.ui.trends = function(elem){
  $('.ui_trend', $(elem)).each(function(){
FnordMetric.ui.format = function(elem){
  $('.ui_trend, .ui_value', $(elem)).each(function(){


    if($(this).attr('data-value')){
      $(this).html(FnordMetric.util.formatGaugeValue('', parseFloat($(this).attr('data-value'))));
    }

    else if($(this).attr('data-percent')){
      $(this).html(FnordMetric.util.formatGaugeValue('__percent__', parseFloat($(this).attr('data-percent'))));
    }

    else if($(this).attr('data-time')){
      $(this).html(FnordMetric.util.formatGaugeValue('__time__', parseFloat($(this).attr('data-time'))));
    }

    else if($(this).attr('data-euro')){
      $(this).html(FnordMetric.util.formatGaugeValue('__euro__', parseFloat($(this).attr('data-euro'))));
    }

    else if($(this).attr('data-dollar')){
      $(this).html(FnordMetric.util.formatGaugeValue('__dollar__', parseFloat($(this).attr('data-dolar'))));
    }

    else if($(this).attr('data-trend')){
      var delta = parseFloat($(this).attr('data-trend'));
      var deg   = 0;

@@ -103,5 +126,8 @@ FnordMetric.ui.trends = function(elem){
          '-moz-transform': 'rotate('+deg+'deg)'
        })
      )  
    }
   

  });
}