Closed waynecai2 closed 6 years ago
Does the process map not display at all, or is only the animation missing?
I remember that I had some trouble with the process map not having any height if the height was not explicitly set within a complex Shiny application. Theoretically, each container should adapt the the size of its parent, but sometimes this does not work, but I did not find out how to fix it.
You would need to give the full example, since I tried to reproduce it with your code and it does show the animation for me (using the current development version on Github):
my_ianimate_process <- function (eventlog) {
ui <- function(request) {
fluidPage(mainPanel(width = 10, shinycssloaders::withSpinner(processanimaterOutput("process")))) }
server <- function(session, input, output) { output$process <- renderProcessanimater(expr = { animate_process(eventlog) })
}
shinyApp(ui, server)
}
library(eventdataR)
my_ianimate_process(patients)
Produces:
Thanks for your quick reply, and I tried your code on my computer, while it does not work. There were nothing displayed.
Here is my sessionInfo(): _R version 3.5.1 (2018-07-02) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 7 x64 (build 7601) Service Pack 1
Matrix products: default
locale: [1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252 LC_NUMERIC=C LC_TIME=English_United States.1252
attached base packages: [1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] svgPanZoom_0.3.3 DiagrammeRsvg_0.1 XML_3.98-1.11 RColorBrewer_1.1-2 treemap_2.4-2 data.table_1.11.4 dplyr_0.7.6 DT_0.4 lubridate_1.7.4
[10] ggplot2_2.2.1 stringr_1.3.1 DiagrammeR_1.0.0 shinythemes_1.1.1 bindrcpp_0.2.2 processanimateR_0.1.1 shiny_1.1.0 shinydashboard_0.7.0 petrinetR_0.1.0
[19] processmonitR_0.1.0 xesreadR_0.2.2 processmapR_0.3.1 eventdataR_0.2.0 edeaR_0.8.1 bupaR_0.4.1
loaded via a namespace (and not attached):
[1] viridis_0.5.1 httr_1.3.1 tidyr_0.8.1 jsonlite_1.5 viridisLite_0.3.0 shinyTime_0.2.1 assertthat_0.2.0 yaml_2.1.19 pillar_1.2.3
[10] glue_1.2.0 downloader_0.4 digest_0.6.15 promises_1.0.1 colorspace_1.3-2 shinycssloaders_0.2.0 htmltools_0.3.6 httpuv_1.4.4.1 plyr_1.8.4
[19] pkgconfig_2.0.1 purrr_0.2.5 xtable_1.8-2 scales_0.5.0 brew_1.0-6 later_0.7.3 tibble_1.4.2 influenceR_0.1.0 lazyeval_0.2.1
[28] cli_1.0.0 rgexf_0.15.3 crayon_1.3.4 magrittr_1.5 mime_0.5 forcats_0.3.0 xml2_1.2.0 ggthemes_3.5.0 Rook_1.1-1
[37] tools_3.5.1 hms_0.4.2 gridBase_0.4-7 plotly_4.7.1 V8_1.5 munsell_0.5.0 compiler_3.5.1 rlang_0.2.1 grid_3.5.1
[46] rstudioapi_0.7 htmlwidgets_1.2 visNetwork_2.0.4 igraph_1.2.1 miniUI_0.1.1.1 labeling_0.3 gtable_0.2.0 curl_3.2 reshape2_1.4.3
[55] R6_2.2.2 gridExtra_2.3 utf8_1.1.4 bindr_0.1.1 readr_1.1.1 stringi_1.1.7 Rcpp_0.12.17 tidyselect0.2.4 _
I think the problem may be that the packages I am using is not compatible.
By the way, I tried some code, and find the following code works:
` library(bupaR) library(processanimateR) library(shiny) library(shinydashboard)
ui <- dashboardPage( dashboardHeader(title = "Basic dashboard"), dashboardSidebar(), dashboardBody(
fluidRow(
box(
width = 12,
tags$head(tags$style("#process{height:90vh !important;}")),
mainPanel(width = 10, shinycssloaders::withSpinner(processanimaterOutput("process")))
),
box(
title = "Controls",
sliderInput("slider", "Number of observations:", 1, 100, 50)
)
)
) )
server <- function(input, output) { set.seed(122) histdata <- rnorm(500)
output$plot1 <- renderPlot({ data <- histdata[seq_len(input$slider)] hist(data)
}) output$process <- renderProcessanimater(expr = { model <- process_map(patients, render = F) %>% DiagrammeR::add_global_graph_attrs(attr = "rankdir", value = input$orientation, attr_type = "graph") animate_process(patients, model) }) }
shinyApp(ui, server) `
I understand that the original problem might have to do with v0.1.1 in combination with an older processmapR version 0.3.1. Please open this again in case you still have problems with the new version 0.2.0, which is to be release on CRAN very soon.
Hi Felix, I tried to use renderProcessanimater and processanimaterOutput to build a shiny dashboard, while the animate process map just not display.
I have tested your ianimate_process function, to make the simplest from, I define a function:
my_ianimate_process <- function (eventlog) { ui <- function(request) { fluidPage(tags$head(tags$style("#process{height:90vh !important;}")), mainPanel(width = 10, shinycssloaders::withSpinner(processanimaterOutput("process")))) } server <- function(session, input, output) { output$process <- renderProcessanimater(expr = { animate_process(eventlog) }) } shinyApp(ui, server) }
This function works, but when I remove tags$head(tags$style("#process{height:90vh !important;}")), the animate process map will not display.
I did a lot of test and find that this function must work with fluidPage and processanimaterOutput("process")) function must be in the mainPanel, otherwise it will not work.