sigmajs (version 0.1.5)

sg_get_nodes_p: Get nodes

Description

Retrieve nodes and edges from the widget.

Usage

sg_get_nodes_p(proxy)

sg_get_edges_p(proxy)

Arguments

proxy

An object of class sigmajsProxy as returned by sigmajsProxy.

Value

The proxy object.

Examples

Run this code
# NOT RUN {
library(shiny)

nodes <- sg_make_nodes()
edges <- sg_make_edges(nodes)

ui <- fluidPage(
  actionButton("start", "Trigger layout"), # add the button
  sigmajsOutput("sg"),
  verbatimTextOutput("txt")
) 

server <- function(input, output){

  output$sg <- renderSigmajs({
    sigmajs() %>%
      sg_nodes(nodes, id, size, color) %>%
      sg_edges(edges, id, source, target)
  })

  observeEvent(input$start, {
    sigmajsProxy("sg") %>% # use sigmajsProxy!
      sg_get_nodes_p()
  })

  output$txt <- renderPrint({
    input$sg_nodes
  })

}
if(interactive()) shinyApp(ui, server) # run

# }

Run the code above in your browser using DataLab