I'm building a shiny app that is supposed to show a bupaR
process_map
, which is kind of working.
Sadly the process_map()
-function returns a dgr_graph
-object, which can't be rendered with the DiagrammeR::renderGrViz()
or DiagrammeR::renderDiagrammeR()
functions. I found a way to convert it to a grViz / htmlwidget
-object with render_graph()
, but this way the graph is not nicely scaled. This is especially bad since I'm dealing with very long linear graphs.
Here is a MWE:
# server.R
library(DiagrammeR)
library(bupaR)
shinyServer(
function(input, output) {
plot <- patients %>%
process_map(rankdir = "TB",
render = FALSE)
output$diagram <- renderGrViz({
render_graph(plot)
})
}
)
# ui.R
library(DiagrammeR)
shinyUI(fluidPage(
titlePanel("DiagrammeR + shiny"),
grVizOutput(outputId = "diagram")
))
Is there a better way of displaying a dgr_graph
-object in shiny, that fills out the whole width of the app and not just a post-stamp size in the middle? Ideal would be something adaptive, without the need for a fixed width in pixels.