Skip to content

Commit

Permalink
Update shiny app for selection test
Browse files Browse the repository at this point in the history
  • Loading branch information
bthieurmel committed May 6, 2015
1 parent 06cfd93 commit e77dd30
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 19 deletions.
43 changes: 24 additions & 19 deletions inst/shiny/server.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,26 +21,31 @@ shinyServer(function(input, output) {
visOptions(navigation = TRUE, dataManipulation = TRUE, stabilize = FALSE,
highlightNearest = TRUE, nodesIdSelection = TRUE)
})

})

output$network2 <- renderVisNetwork({

nb = 5
nodes <- data.frame(id = 1:nb, label = paste("Label", 1:nb),
group = sample(1:10, nb, replace = TRUE), value = 1:nb,
title = paste0("<p>", 1:nb,"<br>Tooltip !</p>"), stringsAsFactors = FALSE)

edges <- data.frame(from = trunc(runif(nb)*(nb-1))+1,
to = trunc(runif(nb)*(nb-1))+1,
value = rnorm(nb, 10), label = paste("Edge", 1:nb),
title = paste0("<p>", 1:nb,"<br>Edge Tooltip !</p>"))

# custom navigation
visNetwork(nodes, edges) %>%
visOptions(navigation = TRUE, dataManipulation = TRUE, stabilize = FALSE, nodesIdSelection = TRUE)

})

output$network2 <- renderVisNetwork({

nb = 5
nodes <- data.frame(id = 1:nb, label = paste("Label", 1:nb),
group = sample(1:10, nb, replace = TRUE), value = 1:nb,
title = paste0("<p>", 1:nb,"<br>Tooltip !</p>"), stringsAsFactors = FALSE)

edges <- data.frame(from = trunc(runif(nb)*(nb-1))+1,
to = trunc(runif(nb)*(nb-1))+1,
value = rnorm(nb, 10), label = paste("Edge", 1:nb),
title = paste0("<p>", 1:nb,"<br>Edge Tooltip !</p>"))

# custom navigation
visNetwork(nodes, edges) %>%
visOptions(navigation = TRUE, dataManipulation = TRUE, stabilize = FALSE, nodesIdSelection = TRUE)



})

output$test <- renderText({
input$network_selected
})

})
})
2 changes: 2 additions & 0 deletions inst/shiny/ui.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ shinyUI(fluidPage(
sliderInput("nb", "number of nodes : ", min = 2, max = 1000, value = 10),
actionButton("goButton", "Go!"),
checkboxInput("legend2", "legend", value = TRUE),
h4("input$network_selected"),verbatimTextOutput("test"),
h4("output$network"),
visNetworkOutput("network",height = "600px"),
hr(),
div(h3("Just to test two networks on same apps"), align = "center"),
Expand Down

0 comments on commit e77dd30

Please sign in to comment.