-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathui.R
142 lines (121 loc) · 4.27 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
# Shiny Dashboard for SAPFLUXNET project
# by Sapfluxnet Team
# UI logic
library(shiny)
library(shinydashboard)
library(leaflet)
library(DT)
# Variables for dropdowns in map
color_vars <- c('Sap Flow Method' = 'sap_flow_method',
'Growth Condition' = 'growth_condition',
'Are coordinates correct?' = 'is_inside_country',
'Site with meteorological data available?' = 'meteo_data_available',
'Trees per species' = 'aprox_numbers_tree_species')
# size_vars <- c('Approximate number of species' = 'aprox_numbers_tree_species',
# 'Approximate number of growing seasons' = 'aprox_years_growing_seasons')
## Header for dashboard
header <- dashboardHeader(title = 'SAPFLUXNET Preliminary Survey', titleWidth = 450)
## Sidebar for dashboard
sidebar <- dashboardSidebar(
width = 300,
sidebarMenu(
# Map and data section
menuItem("Map & Data table", tabName = 'preliminary',
icon = icon('globe')),
# Facts section
menuItem('Metadata facts', tabName = 'Facts',
icon = icon('stats', lib = 'glyphicon')),
# Site inspector
menuItem('Site inspector', tabName = 'inspector',
icon = icon('eye'))
)
)
## Body for dashboard
body <- dashboardBody(
tabItems(
# Preliminary survey tab
tabItem(
tabName = 'preliminary',
fluidRow(
tabBox(
id = 'preliminary', width = 12, height = 600,
# Tab1, map
tabPanel('Map',
tags$head(
# Include our custom CSS
includeCSS("styles.css")
),
leafletOutput('preliminaryMap', height = 600),
absolutePanel(id = 'controls', class = 'panel panel-default',
draggable = TRUE, top = 70, left = "auto",
right = 40, bottom = "auto",
width = 250, height = 400,
h2('Preliminary Data Explorer'),
selectInput('color', 'Color', color_vars,
selected = 'sap_flow_method'),
# selectInput('size', 'Size', size_vars),
plotOutput('histogram')),
tags$div(id = 'thanks',
'Sapfluxnet Team wish to thank all early ',
'contributors that provided this metadata.')),
# Tab2, data table
tabPanel('Data', dataTableOutput('preliminary_table',
width = '90%', height = 600))
)
)
),
# Facts
tabItem(
tabName = 'Facts',
fluidRow(
valueBoxOutput('N_sites', 4),
valueBoxOutput('Countries', 4),
valueBoxOutput('Species', 4)
),
fluidRow(
valueBoxOutput('N_wrong_coord', 4),
valueBoxOutput('Meteo_data', 4)
)
),
# Site inspector
tabItem(
tabName = 'inspector',
# Site selector input
fluidRow(
box(
title = tagList(shiny::icon("gear"), 'Site selector'),
background = "black", width = 4,
selectizeInput(
'site_input', 'Site list',
choices = sort(preliminary_survey_fixed$site_name),
options = list(
placeholder = 'Please select a site below',
onInitialize = I('function() { this.setValue(""); }')
)
)
)
),
# Site info
fluidRow(
# contributor name
box(
title = tagList('Contributor',
shiny::icon('user', lib = 'glyphicon')),
status = 'primary', solidHeader = TRUE, width = 4,
verbatimTextOutput('site_contr')
),
# site species
box(
title = tagList('Species',
shiny::icon('tree-deciduous', lib = "glyphicon")),
status = 'primary', solidHeader = TRUE, width = 4,
verbatimTextOutput('site_sps')
),
# is inside country?
infoBoxOutput('coord_ok')
)
)
)
)
## Build the dashboard
dashboardPage(header, sidebar, body, skin = 'green')