web/fnordmetric-ui.js in fnordmetric-1.2.6 vs web/fnordmetric-ui.js in fnordmetric-1.2.7

- old
+ new

@@ -11381,32 +11381,20 @@ FnordMetric.util.decPrint = function(val){ return (val < 10 ? '0'+val : val); } -FnordMetric.util.formatValue = function(value, round_to){ +FnordMetric.util.formatValue = function(value){ if(value < 10){ - if (typeof round_to != 'undefined') - return value.toFixed(round_to); - else - return value.toFixed(1); + return value.toFixed(1); } if(value < 100){ - if (typeof round_to != 'undefined') - return value.toFixed(round_to); - else - return value.toFixed(1); + return value.toFixed(1); } else if(value > 1000){ - if (typeof round_to != 'undefined') - return (value/1000.0).toFixed(round_to) + "k"; - else - return (value/1000.0).toFixed(1) + "k"; + return (value/1000.0).toFixed(1) + "k"; } else { - if (typeof round_to != 'undefined') - return value.toFixed(round_to); - else - return value.toFixed(0); + return value.toFixed(0); } } FnordMetric.util.formatTimeValue = function(value){ if (value < 60){ @@ -11507,17 +11495,10 @@ element: $('.fnordmetric_container', elem)[0], padding: { top: 0.1, bottom: 0 }, stroke: true }; - - if (elem.attr('data-y-max')) { - gconfig.max = parseFloat(elem.attr('data-y-max')); - } else { - delete gconfig.max; - } - if (elem.attr('data-cardinal') == "on") { gconfig.interpolation = 'cardinal'; } else { gconfig.interpolation = 'linear'; } @@ -11678,11 +11659,11 @@ if (typeof FnordMetric.widgets == 'undefined') FnordMetric.widgets = {}; FnordMetric.widgets.counter = function(elem){ - var gauge, at, scale_by, refresh_timer, refresh_interval; + var gauge, at, refresh_timer, refresh_interval; var widget_key = elem.attr("data-widget-key"); function init() { gauge = elem.attr('data-gauge'); @@ -11690,15 +11671,10 @@ return console.log("[FnordMetric] element is missing the data-gauge attribute"); at = elem.attr('data-at'); if (!at) at = "now"; - if (scale_by = elem.attr('data-scale-by')) - scale_by = parseFloat(elem.attr('data-scale-by')); - else - scale_by = 1; - requestDataAsync(); if (refresh_interval = elem.attr('data-autoupdate')) refresh_interval = parseFloat(refresh_interval); @@ -11744,14 +11720,10 @@ var new_val = current_val + diff; if((diff > 0) && (new_val > target_val)){ new_val = target_val; } if((diff < 0) && (new_val < target_val)){ new_val = target_val; } - if (elem.attr('data-round-to')) - var val_txt = FnordMetric.util.formatValue(new_val * scale_by, - parseInt(elem.attr('data-round-to'), 10)); - else - var val_txt = FnordMetric.util.formatValue(new_val * scale_by); + var val_txt = FnordMetric.util.formatValue(new_val); if (elem.attr('data-unit')) val_txt += elem.attr('data-unit'); elem.attr('data-current', new_val);