-
Notifications
You must be signed in to change notification settings - Fork 2
/
ui.R
191 lines (180 loc) · 7.66 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
# *------------------------------------------------------------------
# | PROGRAM NAME: Solar Energy Calculator
# | DATE: Feb 1 2016
# | CREATED BY: La Minh Hoang
# | PROJECT FILE: ui.R
# | CONTACT: [email protected]
# *----------------------------------------------------------------
# | PURPOSE:
# | -Provide user-interface script for shiny package
# *------------------------------------------------------------------
# | References: http://shiny.rstudio.com/tutorial/
# |
# |
# *------------------------------------------------------------------
# | UPDATES:
# | -Feb 1 2016: Added comments
# |
# *------------------------------------------------------------------
library(shiny)
shinyUI(
navbarPage(
# Application title
title = "Solar Energy Calculator",
tabPanel(title = "Day",
#Sidebar
sidebarLayout(
sidebarPanel(
actionButton("actCalculateDay", label = "Calculate"),
br(),
br(),
dateInput("dateDay", label = "Date input:", value = Sys.Date()),
# Copy the line below to make a slider bar
# sliderInput(
# "hourslider", "Hour:", min = 0,
# max = 24, value = 8
# )
# ,
# sliderInput(
# "minuteslider", "Minute:", min = 0,
# max = 60, value = 0
# )
# ,
numericInput("latDay", label = "Latitude", value = 0),
numericInput("longDay", label = "Longitude", value = 0),
sliderInput(
"gmtsliderDay", "GMT offsets:", min = -12,
max = 12, value = 0
),
sliderInput(
"tiltsliderDay", "Module Tilt Angle:", min = 0,
max = 90, value = 45
),
sliderInput(
"aziDay", "Module Azimuth Angle:", min = 0,
max = 360, value = 180
),
numericInput("sealevelDay", label = "Sea Level (in kilometres):", value = 0)
),
# Show a tabset that includes a plot, summary, and table view
# of the generated distribution
mainPanel(tabsetPanel(
type = "tabs",
tabPanel("Plot", plotOutput("plotDay"), uiOutput("totalEnergyDay")),
tabPanel("Summary", verbatimTextOutput("summaryDay")),
tabPanel("Table", tableOutput("tableDay"))
))
)),
tabPanel(title = "Month",
#Sidebar
sidebarLayout(
sidebarPanel(
actionButton("actCalculateMonth", label = "Calculate"),
br(),
br(),
numericInput("yearMonth", label = "Year: ", value = as.numeric(format(Sys.Date(
), "%Y"))),
selectInput(
"monthMonth", label = "Month: ",
choices = list(
"January" = 1, "February" = 2, "March" = 3,
"April" = 4, "May" = 5, "June" = 6,
"July" = 7, "August" = 8, "September" = 9,
"October" = 10, "November" = 11, "December" = 12
),
selected = as.numeric(format(Sys.Date(), "%m"))
),
numericInput("latMonth", label = "Latitude", value = 0),
numericInput("longMonth", label = "Longitude", value = 0),
sliderInput(
"gmtsliderMonth", "GMT offsets:", min = -12,
max = 12, value = 0
),
sliderInput(
"tiltsliderMonth", "Module Tilt Angle:", min = 0,
max = 90, value = 45
),
sliderInput(
"aziMonth", "Module Azimuth Angle:", min = 0,
max = 360, value = 180
),
numericInput("sealevelMonth", label = "Sea Level (in kilometres):", value = 0)
),
# Show a tabset that includes a plot, summary, and table view
# of the generated distribution
mainPanel(tabsetPanel(
type = "tabs",
tabPanel(
"Plot", plotOutput("plotMonth"), uiOutput("totalEnergyMonth")
),
tabPanel("Summary", verbatimTextOutput("summaryMonth")),
tabPanel("Table", tableOutput("tableMonth"))
))
)),
tabPanel(title = "Year",
#Sidebar
sidebarLayout(
sidebarPanel(
actionButton("actCalculateYear", label = "Calculate"),
br(),
br(),
numericInput("yearYear", label = "Year: ", value = as.numeric(format(Sys.Date(
), "%Y"))),
numericInput("latYear", label = "Latitude", value = 0),
numericInput("longYear", label = "Longitude", value = 0),
sliderInput(
"gmtsliderYear", "GMT offsets:", min = -12,
max = 12, value = 0
),
sliderInput(
"tiltsliderYear", "Module Tilt Angle:", min = 0,
max = 90, value = 45
),
sliderInput(
"aziYear", "Module Azimuth Angle:", min = 0,
max = 360, value = 180
),
numericInput("sealevelYear", label = "Sea Level (in kilometres):", value = 0)
),
# Show a tabset that includes a plot, summary, and table view
# of the generated distribution
mainPanel(tabsetPanel(
type = "tabs",
tabPanel("Plot", plotOutput("plotYear"), uiOutput("totalEnergyYear")),
tabPanel("Summary", verbatimTextOutput("summaryYear")),
tabPanel("Table", tableOutput("tableYear"))
))
)),
tabPanel(title = "Optimal Angle",
#Sidebar
sidebarLayout(
sidebarPanel(
actionButton("actCalculateOptimal", label = "Calculate"),
br(),
br(),
numericInput("yearOptimal", label = "Year: ", value = as.numeric(format(Sys.Date(
), "%Y"))),
numericInput("latOptimal", label = "Latitude", value = 0),
numericInput("longOptimal", label = "Longitude", value = 0),
sliderInput(
"gmtsliderOptimal", "GMT offsets:", min = -12,
max = 12, value = 0
),
numericInput("sealevelOptimal", label = "Sea Level (in kilometres):", value = 0)
),
# Show a tabset that includes a plot, summary, and table view
# of the generated distribution
mainPanel(tabsetPanel(
type = "tabs",
tabPanel(
"Optimal Angle",
br(),
plotOutput("plotOptimal"),
uiOutput("textOptimal")
),
tabPanel("Summary", verbatimTextOutput("summaryOptimal")),
tabPanel("Table", tableOutput("tableOptimal"))
))
))
)
)