I have the shiny
app below in which an activity frequency bar is displayed on top and a process bar in the bottom. Is it possible to enable clicking on a bar in the upper bar graph and subset the process map based on that selection in order to display only the relative nodes connected ?
app.R
library(shiny)
library(shinydashboard)
library(bupaR)
library(processmapR)
library(eventdataR)
library(DiagrammeR)
library(svgPanZoom)
library(DiagrammeRsvg)
library(plotly)
ui <- dashboardPage(
dashboardHeader(title = "decio"),
dashboardSidebar(
collapsed = TRUE
),
dashboardBody(
plotlyOutput("activity_frequency"),
svgPanZoomOutput("pmap"),
)
)
server <- function(input, output,session) {
sip<-bupaR::simple_eventlog(eventlog = eventdataR::sepsis,
case_id = "case_id",
activity_id = "activity",
#activity_instance_id = "activity_instance_id",
timestamp = "timestamp",
#lifecycle_id = "lifecycle",
resource_id = "resource"
)
output$activity_frequency <- renderPlotly({
ggplotly(sip %>% activity_frequency("trace") %>% plot())
})
output$pmap <- renderSvgPanZoom({
process_map(sip, type_nodes = frequency("relative_case",color_scale = "Purples"),type_edges = performance(mean,"days", color_edges = "Purples"),
rankdir = "TB", render = FALSE) %>%
generate_dot() %>%
grViz(width = 800, height = 1600) %>%
export_svg %>%
svgPanZoom(height=800, controlIconsEnabled = TRUE)
})
}
shinyApp(ui, server)