-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathui.R
100 lines (89 loc) · 2.84 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
# app.R
library(shiny)
library(leaflet)
library(readxl)
library(readr)
library(dplyr)
library(DT)
library(shinyjs)
library(shinydashboard)
library(shinythemes)
library(shinyWidgets)
library(sf)
# Define the UI
ui <- fluidPage(
theme = shinytheme("cerulean"),
useShinyjs(),
tags$head(
tags$style(HTML("
@media (max-width: 768px) {
.col-sm-4 {
width: 100%;
padding-bottom: 20px;
}
.col-sm-8 {
width: 100%;
}
}
.leaflet-container {
height: 70vh !important;
}
.well {
margin-bottom: 15px;
}
"))
),
# Application title
titlePanel("Australia Map Data Plotter"),
# Sidebar layout
sidebarLayout(
# Sidebar panel for inputs
sidebarPanel(
width = 4,
# File upload input
wellPanel(
fileInput("dataFile", "Upload CSV, XLS, or XLSX file",
accept = c(".csv", ".xls", ".xlsx")),
# Only show after file is uploaded
conditionalPanel(
condition = "output.fileUploaded",
# Sheet selection for Excel files
conditionalPanel(
condition = "output.isExcel",
selectInput("sheet", "Select Sheet:", choices = NULL)
),
# Column selection inputs
selectInput("latCol", "Select Latitude Column:", choices = NULL),
selectInput("longCol", "Select Longitude Column:", choices = NULL),
# Optional mapping variables
selectInput("colorCol", "Color By (Optional):", choices = NULL, selected = NULL),
selectInput("facetCol", "Facet By (Optional):", choices = NULL, selected = NULL),
# Map controls
selectInput("mapType", "Map Type:",
choices = c("OpenStreetMap", "Esri.WorldImagery", "CartoDB.Positron")),
# Plot button
actionButton("plotBtn", "Plot Data", class = "btn-primary btn-block")
)
),
# Display information about data
conditionalPanel(
condition = "output.fileUploaded",
wellPanel(
h4("Data Summary"),
verbatimTextOutput("dataSummary")
)
)
),
# Main panel for displaying outputs
mainPanel(
width = 8,
tabsetPanel(
tabPanel("Map",
leafletOutput("map", height = "70vh"),
uiOutput("legendUI")),
tabPanel("Data Preview",
DTOutput("dataTable"))
)
)
)
)