-
Notifications
You must be signed in to change notification settings - Fork 1
/
timeline.R
81 lines (72 loc) · 2.58 KB
/
timeline.R
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
library(timevis)
my_cv <- read.csv("static/ccamara-cv-timeline.csv")
timevisDataGroups <- data.frame(
id = c("education", "academic", "research"),
content = c("Education", "Academic", "Research")
)
timevis(my_cv,
groups = timevisDataGroups)
timevisData <- data.frame(
id = 1:11,
content = c("Open", "Open",
"Open", "Open", "Half price entry",
"Staff meeting", "Open", "Adults only", "Open", "Hot tub closes",
"Siesta"),
start = c("2016-05-01 07:30:00", "2016-05-01 14:00:00",
"2016-05-01 06:00:00", "2016-05-01 14:00:00", "2016-05-01 08:00:00",
"2016-05-01 08:00:00", "2016-05-01 08:30:00", "2016-05-01 14:00:00",
"2016-05-01 16:00:00", "2016-05-01 19:30:00",
"2016-05-01 12:00:00"),
end = c("2016-05-01 12:00:00", "2016-05-01 20:00:00",
"2016-05-01 12:00:00", "2016-05-01 22:00:00", "2016-05-01 10:00:00",
"2016-05-01 08:30:00", "2016-05-01 12:00:00", "2016-05-01 16:00:00",
"2016-05-01 20:00:00", NA,
"2016-05-01 14:00:00"),
group = c(rep("lib", 2), rep("gym", 3), rep("pool", 5), NA),
type = c(rep("range", 9), "point", "background")
)
timevisDataGroups <- data.frame(
id = c("lib", "gym", "pool"),
content = c("Library", "Gym", "Pool")
)
templateWC <- function(stage, team1, team2, score1, score2) {
sprintf(
'<table><tbody>
<tr><td colspan="3"><em>%s</em></td></tr>
<tr>
<td>%s</td>
<th> %s - %s </th>
<td>%s</td>
</tr>
<tr>
<td><img src="flags/%s.png" width="31" height="20" alt="%s"></td>
<th></th>
<td><img src="flags/%s.png" width="31" height="20" alt="%s"></td>
</tr>
</tbody></table>',
stage, team1, score1, score2, team2, gsub("\\s", "", tolower(team1)),
team1, gsub("\\s", "", tolower(team2)), team2
)
}
# Data for world cup 2014
dataWC <- data.frame(
id = 1:7,
start = c(
"2014-07-04 13:00",
"2014-07-04 17:00",
"2014-07-05 13:00",
"2014-07-05 17:00",
"2014-07-08 17:00",
"2014-07-09 17:00",
"2014-07-13 16:00"
),
content = c(
templateWC("quarter-finals", "France", "Germany", 0, 1),
templateWC("quarter-finals", "Brazil", "Colombia", 2, 1),
templateWC("quarter-finals", "Argentina", "Belgium", 1, 0),
templateWC("quarter-finals", "Netherlands", "Costa Rica", "0 (4)", "0 (3)"),
templateWC("semi-finals", "Brazil", "Germany", 1, 7),
templateWC("semi-finals", "Netherlands", "Argentina", "0 (2)", "0 (4)"),
templateWC("final", "Germany", "Argentina", 1, 0)
)
)