fig_gantt: Gantt chart

Description Usage Arguments Note See Also Examples

View source: R/figure_gantt.R

Description

This function is designed to create the gantt chart which often used in progress control during projects.

Usage

1
2
3
fig_gantt(rawdata, sort_by_works = T, colors.rect = c("grey30",
  "blue"), colors.bg = c("orange", "black"), size.plan = 12,
  size.real = 10, type = "plan", islegend = T, legend.size = 8)

Arguments

rawdata

A data.frame which contains five columns with names as 'works', 'start_time', 'end_time', 'start_time_real', 'end_time_real'.The works is a character vector to instore the names of work steps, tne start_time stands for the start time in plan, the end_time stands for the end time in plan, the start_time_real stands for the start time in real while the end_time_real means the end time in real. All these four columns must be in the data type of Date() with the format of 'YYYY-MM-DD'.

sort_by_works

Boolean value, while true the rawdata will be sort by the column of works.

colors.rect

A named vector with length two, and the default value is c('plan' = 'grey30', 'real' = 'blue') which controls the colors of rects in the figure.

colors.bg

A vector with length two, contains color values which controls the back groud color of the figure.

size.plan

Control the rect size which stands for time points in plan.

size.real

Control the rect size which stands for time points in real.

type

A character with values of 'plan' or 'real', only valid if the rawdata only have three columns.

islegend

Boolean value, draw legend or not, with default TRUE.

legend.size

integer value controls the size of legend.

Note

If the rawdata contains five columns in the required format, then both the planed work check points and real ones will be plot together. If only one of them is needed then pass the correspond three columns(either be c('works', 'start_time', 'end_time') or be c('works', 'start_time_real', 'end_time_real')) and change the value of type accordingly.

See Also

Other figures: fig_waterfall

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
rawdata <- data.frame(
  works =
    c('Requirements Analysis and Validation', 'Alogrithm 1', 'Alogrithm 2',
      'Alogrithm 3', 'Build System Framwork', 'System Development',
      'Data Base', 'System Deployment', 'Test Run', 'Acceptance'
      ),
  start_time = as.Date(
    c('2018-01-01', '2018-01-20','2018-02-15','2018-03-20', '2018-04-01',
      '2018-05-01','2018-06-30','2018-08-01', '2018-09-01','2018-10-30')
    ),
  end_time = as.Date(
    c('2018-01-19', '2018-02-14', '2018-03-19', '2018-03-31', '2018-04-29',
      '2018-06-29', '2018-07-31', '2018-08-31', '2018-10-29', '2018-11-08')
    ),
  start_time_real = as.Date(
    c('2018-01-02', '2018-01-21', '2018-02-17', '2018-03-25', '2018-04-01',
      '2018-05-02', '2018-06-28', '2018-08-01', '2018-09-05', '2018-10-29')
    ),
  end_time_real = as.Date(
    c('2018-01-20', '2018-02-16', '2018-03-24', '2018-03-31', '2018-05-01',
      '2018-06-27', '2018-07-31', '2018-09-04', '2018-10-28', '2018-11-07')
    ),
  stringsAsFactors = FALSE
  )

fig_gantt(rawdata)

fig_gantt(rawdata[, c('works', 'start_time', 'end_time')])

fig_gantt(rawdata[, c('works', 'start_time_real', 'end_time_real')],
          type = 'real', colors.rect = 'red')

fig_gantt(rawdata[, c('works', 'start_time_real', 'end_time_real')],
          type = 'real', colors.rect = 'red', islegend = FALSE)

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