[tor-commits] [atlas/master] Indicate on y axis whether values are B/s, KB/s, or MB/s.

karsten at torproject.org karsten at torproject.org
Mon Aug 20 07:29:44 UTC 2012


commit bc7a69e92eeedbbd97314c2a01ea5d61bc5da02c
Author: Karsten Loesing <karsten.loesing at gmx.net>
Date:   Thu Aug 9 18:43:10 2012 +0200

    Indicate on y axis whether values are B/s, KB/s, or MB/s.
    
    Implements #5388.
---
 js/views/details/main.js |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/js/views/details/main.js b/js/views/details/main.js
index 8b02421..64698c7 100644
--- a/js/views/details/main.js
+++ b/js/views/details/main.js
@@ -57,6 +57,14 @@ define([
                                     },
                                 grid: { hoverable: true, clickable: true },
                                 xaxis: {mode: 'time', tickLength: 5},
+                                yaxis: {tickFormatter : function suffixFormatter(val, axis) {
+                                if (val > 1000000)
+                                   return (val / 1000000).toFixed(axis.tickDecimals) + " MB/s";
+                                else if (val > 1000)
+                                   return (val / 1000).toFixed(axis.tickDecimals) + " KB/s";
+                                else
+                                   return val.toFixed(axis.tickDecimals) + " B/s";
+                                }},
                         });
                         $("#"+g).resize();
 





More information about the tor-commits mailing list