-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathui.R
100 lines (94 loc) · 3.65 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
library(shiny)
shinyUI(fluidPage(
headerPanel("Bike Share Toronto Ride Visualization and Report"),
sidebarLayout(
sidebarPanel(
wellPanel(
helpText(HTML("<b>LOAD RIDE DATA</b>")),
fileInput(
"file", "Choose tab-delimited file:",
multiple=FALSE,
accept = c('text/plain', 'text/tab-separated-values')
)
),
conditionalPanel(
'input.dataset != "Introduction"',
wellPanel(
helpText(HTML("<b>SETTINGS</b>")),
conditionalPanel(
'input.dataset == "Summary Statistics"',
helpText('Some summary statistics from ride data')
),
conditionalPanel(
'input.dataset == "Most Popular Routes"',
helpText('Number of rides based on route')
),
conditionalPanel(
'input.dataset == "Maps"',
selectInput("facet_map", "Choose facet type:",
c("None" = "all",
"Facet by start and end station" = "facet")
),
numericInput("min_map_ride_freq", "Minimum:", 1, min = 1),
numericInput("max_map_ride_freq", "Maximum:", 100, min = 1),
dateRangeInput("date_range_map", "Date range:",
start = "2010-01-01", end = "2015-12-31",
max = format(Sys.time(), "%Y-%m-%d")),
br(),
actionButton("go_map_button", "Update"),
p("Click 'Update' to refresh the map")
),
conditionalPanel(
'input.dataset == "Charts"',
dateRangeInput("date_range_chart", "Date range:",
start = "2010-01-01", end = "2015-12-31",
max = format(Sys.time(), "%Y-%m-%d")),
radioButtons(
"chart_type", "Select plot type:",
c("Number of trips by month" = "plot_by_month",
"Trip duration by day" = "plot_trip_by_day",
"Trip duration by month" = "plot_trip_by_month",
"Trip duration by most frequent routes" = "plot_trip_by_station",
"Time of day" = "plot_time_of_day",
"Total trips per day" = "plot_num_trips_by_day")
)
),
conditionalPanel(
'input.dataset == "Ride Data"',
helpText("Data table showing the input data")
)
)
),
wellPanel(
helpText(HTML("<b>SOURCE CODE</b>")),
HTML('<a href="https://github.com/kcha/bike_share_ride_report" target="_blank">GitHub</a>')
),
wellPanel(
helpText(HTML("<b>ABOUT ME</b>")),
HTML('Kevin Ha'),
HTML('<br/>'),
HTML('<a href="https://kcha.github.io" target="_blank">https://kcha.github.io</a>')
)
),
mainPanel(
tabsetPanel(
id = 'dataset',
tabPanel('Summary Statistics', htmlOutput('summary')),
tabPanel('Most Popular Routes', dataTableOutput('popular')),
tabPanel('Maps', plotOutput('maps', height = "700px")),
tabPanel('Charts',
conditionalPanel(
'input.chart_type == "plot_trip_by_station"',
selectInput('routes', "Choose route(s):",
width = "100%",
multiple = TRUE,
choices = "")
),
plotOutput('charts', height = "700px")),
tabPanel('Ride Data', dataTableOutput('ridedata')),
tabPanel('README', includeMarkdown('README.md')),
type = "pills"
)
)
)
))