[tor-commits] [metrics-web/master] Always show 2 decimal digits in advbwdist graphs.

karsten at torproject.org karsten at torproject.org
Sun Apr 19 07:16:23 UTC 2020


commit ab52da8d3cb905e521bc2bc550e1707a110312d3
Author: Karsten Loesing <karsten.loesing at gmx.net>
Date:   Sun Apr 19 09:12:02 2020 +0200

    Always show 2 decimal digits in advbwdist graphs.
    
    Fixes #33933.
---
 src/main/R/rserver/rserve-init.R | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/main/R/rserver/rserve-init.R b/src/main/R/rserver/rserve-init.R
index c2e461d..2890da2 100644
--- a/src/main/R/rserver/rserve-init.R
+++ b/src/main/R/rserver/rserve-init.R
@@ -515,7 +515,7 @@ plot_dirbytes <- function(start_p, end_p, path_p) {
     scale_x_date(name = "", breaks = custom_breaks,
       labels = custom_labels, minor_breaks = custom_minor_breaks) +
     scale_y_continuous(name = "",
-      labels = function(x) sprintf("%.1f Gbit/s", x),
+      labels = unit_format(accuracy = 0.1, unit = "Gbit/s"),
       limits = c(0, NA)) +
     scale_colour_hue(name = "",
         breaks = c("dirwrite", "dirread"),
@@ -1176,7 +1176,8 @@ plot_advbwdist_perc <- function(start_p, end_p, p_p, path_p) {
     geom_line() +
     scale_x_date(name = "", breaks = custom_breaks,
       labels = custom_labels, minor_breaks = custom_minor_breaks) +
-    scale_y_continuous(name = "", labels = unit_format(unit = "Gbit/s"),
+    scale_y_continuous(name = "",
+      labels = unit_format(accuracy = 0.01, unit = "Gbit/s"),
       limits = c(0, NA)) +
     scale_colour_hue(name = "Percentile") +
     ggtitle("Advertised bandwidth distribution") +
@@ -1214,7 +1215,8 @@ plot_advbwdist_relay <- function(start_p, end_p, n_p, path_p) {
     geom_line() +
     scale_x_date(name = "", breaks = custom_breaks,
       labels = custom_labels, minor_breaks = custom_minor_breaks) +
-    scale_y_continuous(name = "", labels = unit_format(unit = "Gbit/s"),
+    scale_y_continuous(name = "",
+      labels = unit_format(accuracy = 0.01, unit = "Gbit/s"),
       limits = c(0, NA)) +
     scale_colour_hue(name = "n") +
     ggtitle("Advertised bandwidth of n-th fastest relays") +



More information about the tor-commits mailing list