Skip to content

Commit 75304a0

Browse files
author
=
committed
finished adding features
1 parent fa49aa7 commit 75304a0

File tree

4 files changed

+49
-8
lines changed

4 files changed

+49
-8
lines changed

app/app.R

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ library(dplyr)
33
library(ggplot2)
44
library(webshot)
55
library(htmlwidgets)
6-
library(shinythemes)
76
library(wordcloud2)
87

98
#### Helper Functions ####
@@ -50,7 +49,7 @@ generate_bar_chart <- function(data, column) {
5049

5150
# generate the plot
5251
ggplot(df, aes(x = reorder(word, -freq), y = freq)) +
53-
geom_bar(stat = "identity", fill = "steelblue") +
52+
geom_bar(stat = "identity", fill = "#556b2f") +
5453
theme_minimal() +
5554
labs(title = paste("Counts of the Top Selections", column),
5655
x = column,
@@ -70,11 +69,15 @@ url <- "https://www.pnwherbaria.org/data/getdataset.php?File=UBC_Fungi_Native.zi
7069
#### UI ####
7170

7271
ui <- fluidPage(
73-
theme = shinytheme("cerulean"),
74-
titlePanel("UBC Fungi Native Dataset Summary"),
72+
includeCSS("www/theme.css"),
73+
fluidRow(
74+
column(2, img(src = "fungi_image.png", height = 80)),
75+
column(10, h2("UBC Fungi Native Dataset Summary"))
76+
),
7577

7678
sidebarLayout(
7779
sidebarPanel(
80+
class = "sidebar",
7881
helpText("Filter the dataset using one or more of the following columns"),
7982
br(),
8083
textInput("occurrence_id", "Search by OccurenceID:", ""),
@@ -91,6 +94,7 @@ ui <- fluidPage(
9194

9295
),
9396
mainPanel(
97+
class = "main-content",
9498
tabsetPanel(
9599
id = "tabset1",
96100
tabPanel(
@@ -112,7 +116,7 @@ ui <- fluidPage(
112116
column(4,
113117
selectInput(
114118
"visual_column",
115-
"Choose column for word cloud:",
119+
"Choose column:",
116120
choices = c("Genus", "SpecificEpithet"))
117121
),
118122
column(4,
@@ -270,14 +274,14 @@ server <- function(input, output) {
270274

271275
temp_file <- tempfile(fileext = ".html")
272276
data <- filter_data()
273-
generate_word_cloud(data, input$visual_column)
274-
file.copy(temp_file, file)
277+
saveWidget(generate_word_cloud(data, input$visual_column), file = temp_file, selfcontained = TRUE)
278+
webshot(temp_file, file = file, vwidth = 800, vheight = 600, cliprect = "viewport")
275279

276280
} else if (input$viz_type == "Bar Chart") {
277281

278282
png(file)
279283
data <- filter_data()
280-
generate_bar_chart(data, input$visual_column)
284+
print(generate_bar_chart(data, input$visual_column))
281285
dev.off()
282286

283287
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: UBCFungi2
2+
title: UBCFungi2
3+
username: joelkcamp
4+
account: joelkcamp
5+
server: shinyapps.io
6+
hostUrl: https://api.shinyapps.io/v1
7+
appId: 13535672
8+
bundleId: 9470663
9+
url: https://joelkcamp.shinyapps.io/UBCFungi2/
10+
version: 1
11+
asMultiple: FALSE
12+
asStatic: FALSE

app/www/fungi_image.png

96.2 KB
Loading

app/www/theme.css

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
body {
2+
font-family: 'Arial', sans-serif;
3+
background-color: #A2a569;
4+
}
5+
6+
.sidebar {
7+
background-color: #b0aa7e;
8+
color: #ecf0f1;
9+
padding: 20px;
10+
}
11+
12+
.main-content {
13+
background-color: #cdddb2;
14+
padding: 20px;
15+
border-radius: 5px;
16+
box-shadow: 0 0 10px rgba(0,0,0,0.1);
17+
}
18+
19+
.custom-button {
20+
background-color: #3498db;
21+
color: white;
22+
border: none;
23+
padding: 10px 15px;
24+
border-radius: 3px;
25+
}

0 commit comments

Comments
 (0)