-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathserver.R
58 lines (47 loc) · 2.27 KB
/
server.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
function(input, output, session) {
## Fisheries Production ##
# callModule(card_plot, "fis_prod",
# df = fis_harvest,
# x = "year",
# y = "bbmsy",
# color_group = "stock_id",
# filter_field = "country",
# colors = cols,
# plot_type = "scatter",
# mode = "lines+markers",
# tooltip_text = ~paste("Tonnes:", round(bbmsy, digits = 1),
# "<br>Species:", str_replace(str_extract(fis_harvest$stock_id, "^(\\w+)_(\\w+)"),"_"," "), sep=" "),
# xaxis_label = "Year",
# yaxis_label = "Biomass / Max Sustainable Yield")
## Mariculture Production ##
callModule(card_plot, "mar_prod",
df = mar_harvest,
x = "year",
y = "tonnes",
color_group = "species",
filter_field = "country",
colors = cols,
plot_type = "scatter",
mode = "lines+markers",
tooltip_text = ~paste("Tonnes:", prettyNum(tonnes, big.mark=","), # format numbers > 1,000
"<br>Species:", species, sep=" "),
xaxis_label = "Year",
yaxis_label = "Annual Production (tonnes)")
## Mariculture Baseline Metrics ##
callModule(summary_stats, "mar_baseline",
number_boxes = 3,
statistic = list("19%", "68%", "51%"),
text = list("of global seafood comes from mariculture. Aquaculture, which includes marine and inland production, contributes 53% to all seafood provision.",
"of mariculture produced in 2016 for human consumption came from China. They are followed by South Korea at only 4%!",
"of mariculture is comprised of shellfish production by weight. The remaining 33% is from seaweed and 15% from fish."))
## Mariculture Global Map ##
callModule(card_map, "mar_global_map",
data = mar_global_map,
field = "input",
filter_field = type, # type of data to plot
display_field = "map_data",
display_units = "units",
color_palette = ygb,
legend_title = "Legend",
popup_title = "country")
}