I have below setup for diagram, the graph can only produces the below graph if I have data
value in the environment, it's not looking at the data value I specified in the server at all. What should I do differently?
library(DiagrammeR)
library(shiny)
ui <- fluidPage(
grVizOutput("parameter_plot"),
numericInput("some_values", label = "Some values",
value = 1, min = 1, max = 100, step = 1)
)
server <- function(input, output, session) {
# Define some sample data
output$parameter_plot <- renderGrViz({
# Define some sample data
data = tibble(a=1000,b=input$some_values,c=1000,d=1000,e=1000,f=1,g=1,h=1)
DiagrammeR::grViz("
digraph graph2 {
graph [layout = dot]
# node definitions with substituted label text
node [shape = rectangle, style = filled]
node [fillcolor = lightblue]
a [label = '@@1']
node [fillcolor = Beige]
b [label = '@@2']
c [label = '@@3']
d [label = '@@4']
node [fillcolor = mediumpurple1]
e [label = '@@5']
f [label = '@@6']
g [label = '@@7']
node [fillcolor = darkseagreen1]
h [label = '@@8']
i [label = '@@9']
subgraph cluster1 {
node [fixedsize = true, width = 3]
b -> {c d}
}
subgraph cluster2 {
node [fixedsize = true, width = 3]
e -> f -> g -> e
}
subgraph cluster3 {
node [fixedsize = true, width = 3]
h
i
}
a -> b
a -> e
f -> i
e -> h
}
")
})
}
shinyApp(ui, server)