[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

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



commit bc7a69e92eeedbbd97314c2a01ea5d61bc5da02c
Author: Karsten Loesing <karsten.loesing@xxxxxxx>
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) + "&nbsp;MB/s";
+                                else if (val > 1000)
+                                   return (val / 1000).toFixed(axis.tickDecimals) + "&nbsp;KB/s";
+                                else
+                                   return val.toFixed(axis.tickDecimals) + "&nbsp;B/s";
+                                }},
                         });
                         $("#"+g).resize();
 



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits