/
get_graph.Rd
53 lines (44 loc) · 1.01 KB
/
get_graph.Rd
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
41
42
43
44
45
46
47
48
49
50
51
52
53
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/get.R
\name{sg_get_nodes_p}
\alias{sg_get_nodes_p}
\alias{sg_get_edges_p}
\title{Get nodes}
\usage{
sg_get_nodes_p(proxy)
sg_get_edges_p(proxy)
}
\arguments{
\item{proxy}{An object of class \code{sigmajsProxy} as returned by \code{\link{sigmajsProxy}}.}
}
\value{
The \code{proxy} object.
}
\description{
Retrieve nodes and edges from the widget.
}
\examples{
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
}