R闪亮过滤

时间:2019-03-01 07:15:18

标签: r shiny selectinput

我要实现的目标是,用户可以灵活地禁用/启用第二级过滤器id2('Resource')和id3('Case'):

  1. 启用id2('Resource')id3('Case'):程序基于id1,id2和id3过滤器显示相关结果
  2. id2('Resource')id3('Case')已禁用:程序仅显示1级id1('ThrouputTime')过滤的结果。

我在下面实现(pheusdo)代码,程序将基于在SAMETIME过滤的这3个信息来获取结果,但无法实现上述第二种情况。有什么建议吗?

ui <- dashboardPage(
    dashboardBody(
        tabItems(
                tabItem(tabName = "dashboard",
            fluidRow(
                        box(
                            title = "ThrouputTime",
                            width = 3,
                            sliderInput(inputId="id1", label="ThrouputTime", ...)
                           )    
                ),      
            fluidRow(
                        box(
                            title = "Resource",
                            width = 3,
                            selectInput(inputId="id2", label="resource", ...)
                           ),
                box(
                            title = "Case",
                            width = 3,
                            selectInput(inputId="id3", label="case", ...)
                           )
                )
            )
              )
           )



server <- function(input, output, session){

  observe({
    output$process <- renderProcessanimater(expr = {

      filtered_event <- newevent %>%
        filter_throughput_time(interval = c(input$throughput[1], input$throughput[2])) %>%
        filter_resource(input$id2)  %>%                 
        filter_case(input$id3, reverse = F)                   

        #.... generate a workflow graph based on 'filtered_event' from above    
    })
  })
}

graph <- shinyApp(ui, server)
runApp(graph, host = "0.0.0.0", port = 5050)

0 个答案:

没有答案