如何使用svgPanZoom显示bupaR process_map?

时间:2019-05-14 14:35:19

标签: r shiny

使用bupaR,可以轻松为事件日志创建process_map,并且以下代码可用于在闪亮的应用程序模块中显示此地图:

fluidPage(
  fluidRow(
    column(10, grVizOutput(ns("ProcesAnalyse"))),
    column(2,
         fluidRow(actionButton(inputId = ns("doorloop_start_end_act_Button"), 
                               label = "Start en Eind", icon = NULL), 
                  actionButton(inputId = ns("doorloop_trace_freq_Button"), 
                               label = "Trace Frequentie", icon = NULL)
           )
    )
  ),
  fluidRow(h4("Metrieken"), br(), uiOutput(ns("Metrics")))
  )

  output$ProcesAnalyse <- renderGrViz({
    if (is.null(rv$Doorloop_events)) rv$Doorloop_events <- doorloop_events_reactive()
    withProgress(message = 'Verzamel de process-gegevens...', value = 0, {
    process_map(rv$Doorloop_events, rankdir = "TB", heigth = "2000px")
    })
  }) 

我正在尝试使用svgPanZoom平移或缩放地图。 更改后

grVizOutput(ns("ProcesAnalyse"))

进入

svgPanZoomOutput(ns("ProcesAnalyse"))

并将$ ProcesAnalyse输出到

output$ProcesAnalyse <- renderSvgPanZoom({
  if (is.null(rv$Doorloop_events)) rv$Doorloop_events <- doorloop_events_reactive()
  withProgress(message = 'Verzamel de process-gegevens...', value = 0, {
    svgPanZoom(
      process_map(rv$Doorloop_events, rankdir = "TB", render = FALSE) %>%
      export_svg())
  })
})

度量标准仍然显示,但是我没有(参见)可缩放的process_map。 该文档没有提供任何帮助。

我在哪里弄错了?

1 个答案:

答案 0 :(得分:0)

调用:'process_map(rv $ Doorloop_events,rankdir =“ TB”,render = FALSE)'返回dgr_graph对象,我首先了解到export_svg()将基于该对象构建并返回图形。但是,首先必须使用dgr_graph对象来构建点对象。 输出$ ProcesAnalyse提供所需的输出:

output$ProcesAnalyse <- renderSvgPanZoom({
  if (is.null(rv$Doorloop_events)) rv$Doorloop_events <- doorloop_events_reactive()
  withProgress(message = 'Verzamel de process-gegevens...', value = 0, {
    process_map(rv$Doorloop_events, rankdir = "TB", render = FALSE) %>% 
      generate_dot() %>% 
      grViz(width = 800, height = 1600) %>% 
      export_svg %>% 
      svgPanZoom(height=800, controlIconsEnabled = TRUE)
  })

})