-
Notifications
You must be signed in to change notification settings - Fork 128
Expand file tree
/
Copy pathvisSelectEdges.R
More file actions
40 lines (35 loc) · 1.52 KB
/
visSelectEdges.R
File metadata and controls
40 lines (35 loc) · 1.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#' Function to select edge(s) from network, with shiny only.
#'
#' Function to select edges(s) from network, with shiny only.
#'
#'@param graph : a \code{ \link[visNetwork]{visNetworkProxy}} object
#'@param id : vector of id, edges(s) to select
#'
#'@seealso \link[visNetwork]{visNodes} for nodes options, \link[visNetwork]{visEdges} for edges options, \link[visNetwork]{visGroups} for groups options,
#' \link[visNetwork]{visLegend} for adding legend, \link[visNetwork]{visOptions} for custom option, \link[visNetwork]{visLayout} & \link[visNetwork]{visHierarchicalLayout} for layout,
#' \link[visNetwork]{visPhysics} for control physics, \link[visNetwork]{visInteraction} for interaction, \link[visNetwork]{visNetworkProxy} & \link[visNetwork]{visFocus} & \link[visNetwork]{visFit} for animation within shiny,
#' \link[visNetwork]{visDocumentation}, \link[visNetwork]{visEvents}, \link[visNetwork]{visConfigure} ...
#'
#' @examples
#'\dontrun{
#'
#'# have a look to :
#'shiny::runApp(system.file("shiny", package = "visNetwork"))
#'
#'}
#'
#'@export
#'@references See online documentation \url{https://datastorm-open.github.io/visNetwork/}
visSelectEdges <- function(graph, id){
if(!any(class(graph) %in% "visNetwork_Proxy")){
stop("Can't use visSelectEdges with visNetwork object. Only within shiny & using visNetworkProxy")
}
if(!is.null(id)){
if(length(id) == 1){
id <- list(id)
}
}
data <- list(id = graph$id, selid = id)
graph$session$sendCustomMessage("visShinySelectEdges", data)
graph
}