[tor-commits] [metrics-web/master] Fix bridge graphs for countries with zero users.

karsten at torproject.org karsten at torproject.org
Tue Nov 29 09:45:41 UTC 2011


commit c89c965adc3fa371de3efede87f19b1d758f374e
Author: Karsten Loesing <karsten.loesing at gmx.net>
Date:   Tue Nov 29 10:44:07 2011 +0100

    Fix bridge graphs for countries with zero users.
    
    Bug reported by katmagic.
---
 rserve/graphs.R |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/rserve/graphs.R b/rserve/graphs.R
index 1b5fd43..c8265c3 100644
--- a/rserve/graphs.R
+++ b/rserve/graphs.R
@@ -713,8 +713,9 @@ plot_bridge_users <- function(start, end, country, path, dpi) {
         "https://metrics.torproject.org/", sep = ""),
         format = date_breaks$format, major = date_breaks$major,
         minor = date_breaks$minor) +
-    scale_y_continuous(name = "", limits = c(0, max(bridgeusers$users,
-        na.rm = TRUE)), formatter = formatter) +
+    scale_y_continuous(name = "", limits = c(0,
+        ifelse(length(na.omit(bridgeusers$users)) == 0, 0,
+        max(bridgeusers$users, na.rm = TRUE))), formatter = formatter) +
     opts(title = title)
   ggsave(filename = path, width = 8, height = 5, dpi = as.numeric(dpi))
 }



More information about the tor-commits mailing list