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 ##########################