fig_event_storm: Event Storm

Description Usage Arguments See Also Examples

View source: R/figure_event_storm.R

Description

This function create a figure which discribes the time spent during different stages in different events.

Usage

1
2
3
fig_event_storm(rawdata, palette = NULL, colours = NULL,
  line.size = 3, angle = 0, expand = 0.08, isxtext = FALSE,
  hjust.xtext = c(-0.5, 0.6), islegend = TRUE, legend.size = 8)

Arguments

rawdata

A data.frame with five columns: event_id, integer vector identify each event; event_label, the label of each event, not necessary if isxtext is set to FALSE; stage_label, labels of stages during a whole event; start_time, beginning of each stage; end_time, end of each of each satge;

palette

Character value, name of a palette. IF palette is given, the parameter colours won't be use.

colours

A vector gives out the colours.

line.size

Size of each event.

angle

Numeric value between 0 and pi*2, controls the direction of the figure.

expand

Numeric value controls the space between start and end.

isxtext

Whether to add text at start positoion.

hjust.xtext

A numeric vector with length two, controls the position of text, only valid if isxtext is set to TRUE.

islegend

Whether to add legend to the figure.

legend.size

Size of legend key.

See Also

Other figure: fig_bubble_rect, fig_calendar, fig_event_line, fig_parallel

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# build test data
step.num <- 7
num <- 40

base_time <- as.Date(
  c('2018-01-01','2018-02-20', '2018-04-12', '2018-05-13','2018-06-30',
    '2018-08-01', '2018-09-29', '2018-12-31')
  )

biase <- sin(seq(0, 3, length.out = num))

start_time <- c()
end_time <- c()
for (i in 1:num) {
  temp <- base_time[-1] + round(abs(rnorm(step.num, 20*biase[i], 0.2)))
  temp <- c(base_time[1], temp)
  start_time <- c(start_time, temp[1:step.num])
  end_time <- c(end_time, temp[-1])
}
rawdata <- data.frame(
  event_id = rep(1:num, each = step.num),
  event_label = rep(1:num, each = step.num),
  stage_label = rep(c(
      'Requirements Analysis and Validation',
      'Alogrithm', 'Build System Framwork', 'System Development',
      'Data Base', 'System Deployment', 'Test Run'
    ), num),
  start_time = start_time,
  end_time = end_time,
  stringsAsFactors = FALSE
)

head(rawdata)

# plot the figure
fig_event_storm(rawdata)


fig_event_storm(rawdata, islegend = FALSE)

purplezippo/ggpkt documentation built on May 21, 2019, 10:34 a.m.