commit 3b41eaaa410252b71d386b5d90a7945acde93b56 Author: Karsten Loesing karsten.loesing@gmx.net Date: Sat Sep 29 13:37:34 2012 -0400
Add option to draw censorship events w/o expected user ranges. --- rserve/graphs.R | 14 ++++++++------ .../ernie/web/GraphParameterChecker.java | 2 +- web/WEB-INF/users.jsp | 8 +++++--- 3 files changed, 14 insertions(+), 10 deletions(-)
diff --git a/rserve/graphs.R b/rserve/graphs.R index f5bc089..af186f2 100644 --- a/rserve/graphs.R +++ b/rserve/graphs.R @@ -705,20 +705,22 @@ plot_direct_users <- function(start, end, country, events, path, dpi) { max_y <- ifelse(length(na.omit(u$users)) == 0, 0, max(u$users, na.rm = TRUE)) plot <- ggplot(u, aes(x = as.Date(date, "%Y-%m-%d"), y = users)) - if (length(na.omit(u$users)) > 0 & events == "on" & country != "all") { + if (length(na.omit(u$users)) > 0 & events != "off" & country != "all") { r <- read.csv( "/srv/metrics.torproject.org/web/detector/direct-users-ranges.csv", stringsAsFactors = FALSE) r <- r[r$date >= start & r$date <= end & r$country == country, c("date", "minusers", "maxusers")] - if (length(r$maxusers) > 0) - max_y <- max(max_y, max(r$maxusers, na.rm = TRUE)) r <- cast(rbind(melt(u, id.vars = "date"), melt(r, id.vars = "date"))) upturns <- r[r$users > r$maxusers, 1:2] downturns <- r[r$users < r$minusers, 1:2] - plot <- plot + - geom_ribbon(data = r, aes(ymin = minusers, ymax = maxusers), - fill = "gray") + if (events == "on") { + if (length(r$maxusers) > 0) + max_y <- max(max_y, max(r$maxusers, na.rm = TRUE)) + plot <- plot + + geom_ribbon(data = r, aes(ymin = minusers, ymax = maxusers), + fill = "gray") + } if (length(upturns$date) > 0) plot <- plot + geom_point(data = upturns, aes(x = date, y = users), size = 5, diff --git a/src/org/torproject/ernie/web/GraphParameterChecker.java b/src/org/torproject/ernie/web/GraphParameterChecker.java index c939035..16d0db4 100644 --- a/src/org/torproject/ernie/web/GraphParameterChecker.java +++ b/src/org/torproject/ernie/web/GraphParameterChecker.java @@ -56,7 +56,7 @@ public class GraphParameterChecker { sb.append("," + country[0]); } this.knownParameterValues.put("country", sb.toString()); - this.knownParameterValues.put("events", "on,off"); + this.knownParameterValues.put("events", "on,off,points"); this.knownParameterValues.put("language", "all,en,zh_CN,fa"); this.knownParameterValues.put("source", "all,siv,moria,torperf"); this.knownParameterValues.put("filesize", "50kb,1mb,5mb"); diff --git a/web/WEB-INF/users.jsp b/web/WEB-INF/users.jsp index b1e11a6..f422123 100644 --- a/web/WEB-INF/users.jsp +++ b/web/WEB-INF/users.jsp @@ -48,9 +48,11 @@ based on the requests seen by a few dozen directory mirrors.</p> </p><p> Show possible censorship events if available (<a href="http://research.torproject.org/techreports/detector-2011-09-09.pdf">BETA</a>) - <input type="checkbox" name="events" value="on" - <c:if test="${direct_users_events[0] eq 'on'}"> checked</c:if> - ></input> + <select name="events"> + <option value="off">Off</option> + <option value="on"<c:if test="${direct_users_events[0] eq 'on'}"> selected</c:if>>On: both points and expected range</option> + <option value="points"<c:if test="${direct_users_events[0] eq 'points'}"> selected</c:if>>On: points only, no expected range</option> + </select> </p><p> Resolution: <select name="dpi"> <option value="72"<c:if test="${direct_users_dpi[0] eq '72'}"> selected</c:if>>Screen - 576x360</option>
tor-commits@lists.torproject.org