bupaverse / processanimateR

Token replay animation for process maps created with processmapR by using SVG animations (SMIL) and the htmlwidget package.
https://bupaverse.github.io/processanimateR/
Other
66 stars 11 forks source link

processanimater-legend : disappears - shinydashboard - multiple tabs - animate process #32

Closed urvikalia closed 3 years ago

urvikalia commented 3 years ago

When multiple animate process (process map) are placed in different tabs on shiny dashboard, the legends disappear for the animation on second tab. Wanted to check if it is a know limitation or there is a workaround for it.

legends disappear on the second tab "resource map". steps to reproduce : click on process map tab and then resource map tab.

Screenshot 2020-12-02 at 3 53 48 PM

sampleCode.pdf

urvikalia commented 3 years ago

Probably the issue might be because of something else. As simply placing multiple animations on the fluid page doesn't create a problem, but having it within different tab panels does.

fmannhardt commented 3 years ago

Do you have a reproducible example? Then, I could explore this when I find time (not in the next weeks). It may be due to some wrong selectors or colliding element identifiers.

urvikalia commented 3 years ago

@fmannhardt thanks. attached is a reproducible example. Click on the other tab and legends go away for the resource Tab.

`

Note: currently both the process maps are the same

Simple shiny dashboard

library(shiny) library(shinydashboard) library(edeaR) library(processanimateR) library(bupaR)

eventlog <- patients ui <- dashboardPage( dashboardHeader(), dashboardSidebar( sidebarMenu( menuItem("Process Map", tabName = "process", icon = icon("dashboard")), menuItem("Resource Map", tabName = "resource", icon = icon("dashboard"))

)

), dashboardBody(

fluidPage(tabItems(
  tabItem(tabName = "process",
          processanimaterOutput("process")),
  tabItem(tabName = "resource",
          processanimaterOutput("process2"))

)) 

))

server <- function(input, output) {

data <- reactive({ eventlog })

output$process <- renderProcessanimater(expr = { graph <- processmapR::process_map(data(), render = F) model <- DiagrammeR::add_global_graph_attrs(graph, attr = "rankdir", value = NULL, attr_type = "graph")

animate_process(
  data(),
  model,
  mode = "absolute",
  legend = "color",
  mapping = token_aes(
    color = token_scale(
      "handling",
      scale = "ordinal",
      range = RColorBrewer::brewer.pal(5, "YlOrBr")
    )
  ),
  duration = 60
)

})

output$process2 <- renderProcessanimater(expr = { graph <- processmapR::process_map(data(), render = F) model <- DiagrammeR::add_global_graph_attrs(graph, attr = "rankdir", value = NULL, attr_type = "graph") animate_process( data(), model, mode = "absolute", legend = "color", mapping = token_aes( color = token_scale( "handling", scale = "ordinal", range = RColorBrewer::brewer.pal(5, "YlOrBr") ) ), duration = 60 )

}) }

shinyApp(ui, server) `

fmannhardt commented 3 years ago

Sorry for the long delay. This was relatively easy to fix. I pushed it to the dev branch.

urvikalia commented 3 years ago

Thanks, felix