Closed kyleweise closed 6 years ago
Does it work by adding the follow to the graph?
sg_settings(enableEdgeHovering = TRUE)
Its one of the many settings, somewhat hidden I must admit.
Hi John, I tried adding that line to my sigmajs() %>% ...
pipe, along with raising the edgeHoverPrecision = 10
so that it would most certainty fire, and still no output.
Goodness.
Apologies for the late "fix" @kyleweise . I found the problem, for edge hover to work one must:
sg_settings(enableEdgeHovering = TRUE)
size
to edges.This works:
library(shiny)
library(sigmajs)
nodes <- sg_make_nodes(100)
edges <- sg_make_edges(nodes)
edges$size <- runif(1, 5, nrow(edges)) # add size
ui <- fluidPage(
sigmajsOutput("sg"),
p("Hover over a node or edge"),
verbatimTextOutput("hoverNode"),
verbatimTextOutput("hoverEdge")
)
server <- function(input, output){
output$sg <- renderSigmajs({
sigmajs() %>%
sg_nodes(nodes, id, size, color) %>%
sg_edges(edges, id, source, target, size) %>% # pass size
sg_settings(enableEdgeHovering = TRUE)
})
# capture node hover
output$hoverNode <- renderPrint({
paste0("This is node number: ", input$sg_over_node[["id"]])
})
# capture edge hover
output$hoverEdge <- renderPrint({
paste0("This is edge number: ", input$sg_over_edge[["id"]])
})
}
shinyApp(ui, server) # run
Let me know if this works, feel free to close if it's OK.
Thanks for reporting that, I will add this to the documentation.
Hello, very interested in this package and it is very well documented so kudos for that! However, I'm running into a problem when I try to capture hovering over edge events. Following this as a guide, here is my code:
As I move my mouse around, it captures the node hovering events just fine, but displays nothing when hovering over an edge. Is this a bug or am I doing something incorrectly?
Thanks!
-Kyle