Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions R/VisGraphAuto.R
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,30 @@ plot.dependenciesGraphs <- function(object, block = FALSE, width = NULL, height
visPhysics(solver = "repulsion", stabilization = list(enabled = FALSE, iterations = 5000, onlyDynamicEdges = FALSE))
}

plot.dependenciesGraphs <- function(object, block = FALSE, width = NULL, height = NULL) {
# Show circular reference in red
red_if_circular <- function(edges) {
from_to <- paste(edges$from, edges$to)
to_from <- paste(edges$to, edges$from)
circular <- from_to %in% to_from
ifelse(circular, "red", "#848484")
}

object[[2]]$color <- red_if_circular(object[[2]])

visNetwork(object[[1]], object[[2]], width = width, height = height) %>%
visEdges(arrows = "from") %>%
visOptions(highlightNearest = TRUE, nodesIdSelection = TRUE) %>%
visInteraction(dragNodes = !block) %>%
visPhysics(
solver = "repulsion",
stabilization = list(
enabled = FALSE,
iterations = 5000,
onlyDynamicEdges = FALSE
)
)
}

#' Launch shiny app
#'
Expand Down