here i am taking separate input at top left corner in input box for specific node can this input box should be attached with its node?

library(shiny)
library(visNetwork)
library(DiagrammeR)

ui <- fluidPage(
titlePanel("Combined Output Example"),
sidebarLayout(
sidebarPanel(
h4("Select Node Values"),
numericInput("node_A", "Node A:", value = 1, min = 0),
numericInput("node_B", "Node B:", value = 2, min = 0),
numericInput("node_C", "Node C:", value = 3, min = 0),
numericInput("node_D", "Node D:", value = 4, min = 0)
),
mainPanel(
grVizOutput("graph", height = "500px"),

)

)
)

server <- function(input, output) {
output$graph <- renderGrViz({
# Define the graph using DiagrammeR
node_A <- input$node_A
node_B <- input$node_B
node_C <- input$node_C
node_D <- input$node_D

graph_str <- paste0("digraph {

                     graph[rankdir = LR]

                     node[shape = ellipse, style = filled]
                     A[label = '", node_A, "']
                     B[label = '", node_B, "']
                     C[label = '", node_C, "']
                     D[label = '", node_D, "']


                     edge[color = black]
                     A->B
                     B->C
                     C->D


                     }")
grViz(graph_str)

})

}

shinyApp(ui, server)

This topic was automatically closed 54 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.