-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathui.R
193 lines (187 loc) · 6.67 KB
/
ui.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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
library(shiny)
library(shinydashboard)
library(leaflet)
library(plotly)
library(shinyWidgets)
dashboardPage(skin = "yellow", #“blue”, “black”, “purple”, “green”, “red”, “yellow”
dashboardHeader(title = "RunAway"),
dashboardSidebar(
sidebarMenu(id = "sbm",
menuItem("Introduction", tabName = "introduction", icon = icon("book")),
menuItem("Attacks by Country", tabName = "globalattack1", icon = icon("area-chart")),
menuItem("Word Search", tabName = "wordsearch", icon = icon("search"))
)
),
dashboardBody(
tags$head(
tags$link(rel = "stylesheet", type = "text/css", href = "animate.css"),
tags$link(rel = "stylesheet", type = "text/css", href = "app.css"),
tags$script(src = "app.js")
),
tabItems(
tabItem(tabName = "introduction",
fluidPage(
fluidRow(
box( width = 12,
htmlOutput("intro"))
)
)
),
tabItem(tabName = "globalattack1",
fluidPage(
fluidRow(
column(width = 12, class = "col-sm-6 col-md-3",
valueBoxOutput("totAttacks", width = "100%")
),
column(width = 12, class = "col-sm-6 col-md-3",
valueBoxOutput("totSuccess", width = "100%")
),
column(width = 12, class = "col-sm-6 col-md-3",
valueBoxOutput("totDeaths", width = "100%")
),
column(width = 12, class = "col-sm-6 col-md-3",
valueBoxOutput("totRansom", width = "100%")
)
),
fluidRow(id = "filters",
box(title = HTML("<b>Filters</b> <i class='fa fa-filter text-small'></i>"), width = 12, collapsible = T,
column(
width = 6,
radioButtons("filterType", label = h4("Attacks based on:"),
choices = list("Fatalties" = 1, "Ransom" = 2),
selected = 1)
),
conditionalPanel(
condition = "input.filterType == 1",
column(
width = 6,
sliderInput("nkills",label = h4("Number of kills per attack:"),
min = 0,
max = max(data1$nkill,na.rm = T),
value = c(0,max(data1$nkill,na.rm = T)),
width = "100%"
)
)# end of column
),# end of conditional panel
conditionalPanel(
condition = "input.filterType == 2",
column(
width = 6,
sliderInput("ransomamt",label = h4("Attack's ransom:"),
min = 0,
max = max(data1$ransomamt,na.rm = T),
value = c(0,max(data1$ransomamt,na.rm = T)),
width = "100%"
)
)# end of column
), # end of conditional panel
column(width = 12, class = "col-sm-12 col-md-6 col-md-offset-6",
selectInput("selRegion",
h4("Filter by region:"),
choices = c(All='All', as.character(regionList)), selected = 'All',
width = "100%"
)
)
)
),
fluidRow(
box(
title = "Displaying data:",
solidHeader = T,
status = "primary",
width = 12,
column(width = 12, class = "col-sm-12 col-md-6",
box(
title = "Map of the attacks:",
collapsible = T,
solidHeader = F,
status = "info",
width = "100%",
leafletOutput("map", width = "100%")
)
),
# column(width = 12, class = "col-sm-12 col-md-6",
# box(
# title = "Map of the countries:",
# collapsible = T,
# solidHeader = F,
# status = "info",
# width = "100%",
# plotlyOutput("regionMap")
# )
# ),
column(width = 12, class = "col-sm-12 col-md-6",
box(title = "Attacks' countries:",
collapsible = T,
solidHeader = F,
status = "info",
width = "100%",
plotlyOutput("attCoutries", width = "100%", height = 200)
)
),
column(width = 12, class = "col-sm-12 col-md-6",
box(title = "Attack types:",
collapsible = T,
solidHeader = F,
status = "info",
width = "100%",
plotlyOutput("attType", width = "100%", height = 200)
)
),
box(title = "First 10 countries per fatalities:",
collapsible = T,
solidHeader = F,
status = "info",
width = 12,
plotlyOutput("fatCountries", width = "100%")
)
)
)
)
),
tabItem(tabName = "wordsearch",
fluidPage(
fluidRow(
box( width = 12,
column( width = 12,
searchInput(
inputId = "searchBox",
label = HTML("<h2>Search for a word: <small>(This query might take a while)</small></h2>"),
placeholder = "e.g. Bomb",
btnSearch = icon("search"),
btnReset = icon("remove"),
width = "100%"
)#,
#textInput("searchBox", h2("Search for a word:"), placeholder = "e.g. Bomb"),
#actionButton("searchBtn", "Search", width = "100%")
),
column( width = 12,
htmlOutput("totResults")
)
)
),
fluidRow(
box(title = "Attacks' countries:", status = "primary",
width = 6,
collapsible = T,
plotlyOutput("srcAttCoutries", width = "100%", height = 200)
),
box(title = "Terrorist organizations:", status = "primary",
width = 6,
collapsible = T,
plotlyOutput("srcTerrOrg", width = "100%", height = 200)
)
),
fluidRow(
box(title = "Results' table:", width = 12,
collapsible = T,
column( width = 12,
dataTableOutput('searchTbl')
)
)
)
)
)
)
)
)