Description Usage Arguments Details Value See Also Examples
Get events server-side.
1 | sg_events(sg, events)
|
sg |
An object of class |
events |
A vector of valid events (see section below). |
Events:
Valid events to pass to events
.
clickNode
clickNodes
clickEdge
clickEdges
clickStage
doubleClickStage
rightClickStage
doubleClickNode
doubleClickNodes
doubleClickEdge
doubleClickEdges
rightClickNode
rightClickNodes
rightClickEdge
rightClickEdges
hoverNode
hoverNodes
hoverEdge
hoverEdges
outNode
outNodes
outEdge
outEdges
An object of class htmlwidget
which renders the visualisation on print.
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 | library(shiny)
nodes <- sg_make_nodes()
edges <- sg_make_edges(nodes)
ui <- fluidPage(
sigmajsOutput("sg"),
p("Click on a node"),
verbatimTextOutput("clicked")
)
server <- function(input, output){
output$sg <- renderSigmajs({
sigmajs() %>%
sg_nodes(nodes, id, size, color) %>%
sg_edges(edges, id, source, target) %>%
sg_events("clickNode")
})
# capture node clicked
output$clicked <- renderPrint({
input$sg_click_node
})
}
## Not run: shinyApp(ui, server)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.