From cbef6049e8f6bbda6913f03de84d211375340037 Mon Sep 17 00:00:00 2001 From: Benoit Thieurmel Date: Mon, 26 Jun 2017 10:39:58 +0200 Subject: [PATCH] add some man on collapse --- R/visOptions.R | 22 ++++++++++++++++++++++ man/visOptions.Rd | 22 ++++++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/R/visOptions.R b/R/visOptions.R index 3b96c61..62dae47 100644 --- a/R/visOptions.R +++ b/R/visOptions.R @@ -102,6 +102,28 @@ #' outline:none;')) #' #' ########################## +#' # collapse +#' ########################## +#' +#' nodes <- data.frame(id = 1:15, label = paste("Label", 1:15), +#' group = sample(LETTERS[1:3], 15, replace = TRUE)) +#' +#' edges <- data.frame(from = trunc(runif(15)*(15-1))+1, +#' to = trunc(runif(15)*(15-1))+1) +#' +#' # keeping all parent node attributes +#' visNetwork(nodes, edges) %>% visEdges(arrows = "to") %>% +#' visOptions(collapse = TRUE) +#' +#' # setting some properties +#' visNetwork(nodes, edges) %>% visEdges(arrows = "to") %>% +#' visOptions(collapse = list(enabled = TRUE, clusterOptions = list(shape = "square"))) +#' +#' # enable / disable open cluster (proxy only) : +#' # visEvents(type = "off", doubleClick = "networkOpenCluster") +#' # visEvents(type = "on", doubleClick = "networkOpenCluster") +#' +#' ########################## #' # selectedBy #' ########################## #' nodes <- data.frame(id = 1:15, label = paste("Label", 1:15), diff --git a/man/visOptions.Rd b/man/visOptions.Rd index b140276..555886d 100644 --- a/man/visOptions.Rd +++ b/man/visOptions.Rd @@ -120,6 +120,28 @@ visNetwork(nodes, edges) \%>\% border:none; outline:none;')) +########################## +# collapse +########################## + +nodes <- data.frame(id = 1:15, label = paste("Label", 1:15), + group = sample(LETTERS[1:3], 15, replace = TRUE)) + +edges <- data.frame(from = trunc(runif(15)*(15-1))+1, + to = trunc(runif(15)*(15-1))+1) + +# keeping all parent node attributes +visNetwork(nodes, edges) \%>\% visEdges(arrows = "to") \%>\% + visOptions(collapse = TRUE) + +# setting some properties +visNetwork(nodes, edges) \%>\% visEdges(arrows = "to") \%>\% + visOptions(collapse = list(enabled = TRUE, clusterOptions = list(shape = "square"))) + +# enable / disable open cluster (proxy only) : +# visEvents(type = "off", doubleClick = "networkOpenCluster") +# visEvents(type = "on", doubleClick = "networkOpenCluster") + ########################## # selectedBy ##########################