Commit c8a34143 authored by Karsten Loesing's avatar Karsten Loesing
Browse files

Stop hard-coding versions.

parent 28f567c1
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -381,18 +381,18 @@ write_networksize <- function(start_p = NULL, end_p = NULL, path_p) {
}

prepare_versions <- function(start_p, end_p) {
  read.csv(paste(stats_dir, "versions.csv", sep = ""),
    colClasses = c("date" = "Date")) %>%
  read_csv(paste(stats_dir, "versions.csv", sep = ""),
      col_types = cols(
        date = col_date(format = ""),
        version = col_character(),
        relays = col_double())) %>%
    filter(if (!is.null(start_p)) date >= as.Date(start_p) else TRUE) %>%
    filter(if (!is.null(end_p)) date <= as.Date(end_p) else TRUE)
}

plot_versions <- function(start_p, end_p, path_p) {
  s <- prepare_versions(start_p, end_p)
  known_versions <- c("Other", "0.1.0", "0.1.1", "0.1.2", "0.2.0",
        "0.2.1", "0.2.2", "0.2.3", "0.2.4", "0.2.5", "0.2.6", "0.2.7",
        "0.2.8", "0.2.9", "0.3.0", "0.3.1", "0.3.2", "0.3.3", "0.3.4",
        "0.3.5")
  known_versions <- unique(s$version)
  getPalette <- colorRampPalette(brewer.pal(12, "Paired"))
  colours <- data.frame(breaks = known_versions,
    values = rep(brewer.pal(min(12, length(known_versions)), "Paired"),