This function animates the cases stored in a `bupaR` event log on top of a process model. Each case is represented by a token that travels through the process model according to the waiting and processing times of activities. Currently, animation is only supported for process models created by process_map of the `processmapR` package. The animation will be rendered as SVG animation (SMIL) using the `htmlwidgets` framework. Each token is a SVG shape and customizable.

animate_process(
  eventlog,
  processmap = process_map(eventlog, render = F, ...),
  renderer = renderer_graphviz(),
  mode = c("absolute", "relative", "off"),
  duration = 60,
  jitter = 0,
  timeline = TRUE,
  legend = NULL,
  initial_state = c("playing", "paused"),
  initial_time = 0,
  repeat_count = 1,
  repeat_delay = 0.5,
  epsilon_time = duration/1000,
  mapping = token_aes(),
  token_callback_onclick = c("function(svg_root, svg_element, case_id) {", "}"),
  token_callback_select = token_select_decoration(),
  activity_callback_onclick = c("function(svg_root, svg_element, activity_id) {", "}"),
  activity_callback_select = activity_select_decoration(),
  elementId = NULL,
  preRenderHook = NULL,
  width = NULL,
  height = NULL,
  sizingPolicy = htmlwidgets::sizingPolicy(browser.fill = TRUE, viewer.fill = TRUE,
    knitr.figure = FALSE, knitr.defaultWidth = "100%", knitr.defaultHeight = "300"),
  ...
)

Arguments

eventlog

The `bupaR` event log object that should be animated

processmap

A process map created with `processmapR` (process_map) on which the event log will be animated. If not provided a standard process map will be generated from the supplied event log.

renderer

Whether to use Graphviz (renderer_graphviz) to layout and render the process map, or to render the process map using Leaflet (renderer_leaflet) on a geographical map.

mode

Whether to animate the cases according to their actual time of occurrence (`absolute`) or to start all cases at once (`relative`).

duration

The overall duration of the animation, all times are scaled according to this overall duration.

jitter

The magnitude of a random coordinate translation, known as jitter in scatterplots, which is added to each token. Adding jitter can help to disambiguate tokens drawn on top of each other.

timeline

Whether to render a timeline slider in supported browsers (Work only on recent versions of Chrome and Firefox).

legend

Whether to show a legend for the `size` or the `color` scale. The default is not to show a legend.

initial_state

Whether the initial playback state is `playing` or `paused`. The default is `playing`.

initial_time

Sets the initial time of the animation. The default value is `0`.

repeat_count

The number of times the process animation is repeated.

repeat_delay

The seconds to wait before one repetition of the animation.

epsilon_time

A (small) time to be added to every animation to ensure that tokens are visible.

mapping

A list of aesthetic mappings from event log attributes to certain visual parameters of the tokens. Use token_aes to create a suitable mapping list.

token_callback_onclick

A JavaScript function that is called when a token is clicked. The function is parsed by JS and received three parameters: `svg_root`, 'svg_element', and 'case_id'.

token_callback_select

A JavaScript callback function called when token selection changes.

activity_callback_onclick

A JavaScript function that is called when an activity is clicked. The function is parsed by JS and received three parameters: 'svg_root', 'svg_element', and 'activity_id'.

activity_callback_select

A JavaScript callback function called when activity selection changes.

elementId

passed through to createWidget. A custom elementId is useful to capture the selection events via input$elementId_tokens and input$elementId_activities when used in Shiny.

preRenderHook

passed through to createWidget.

width, height

Fixed size for widget (in css units). The default is NULL, which results in intelligent automatic sizing based on the widget's container.

sizingPolicy

Options that govern how the widget is sized in various containers (e.g. a standalone browser, the RStudio Viewer, a knitr figure, or a Shiny output binding). These options can be specified by calling the sizingPolicy function.

...

Options passed on to process_map.

See also

process_map, token_aes

Examples

data(example_log)

# Animate the process with default options (absolute time and 60s duration)
animate_process(example_log)
# \donttest{ # Animate the process with default options (relative time, with jitter, infinite repeat) animate_process(example_log, mode = "relative", jitter = 10, repeat_count = Inf)
# }