diff --git a/dashboard.Rmd b/dashboard.Rmd
index ea8ddd4..ff36684 100644
--- a/dashboard.Rmd
+++ b/dashboard.Rmd
@@ -284,6 +284,23 @@ storm_track <- reactive({
# Preprocess the track data with colors
result <- result %>%
mutate(
+ hurricane_category = case_when(
+
+ # Hurricane Cat 1
+ windspeed >= 64 & windspeed <= 82 ~ 1,
+
+ # Hurricane Cat 2
+ windspeed >= 83 & windspeed <= 95 ~ 2,
+
+ # Hurricane Cat 3
+ windspeed >= 96 & windspeed <= 112 ~ 3,
+
+ # Hurricane Cat 4
+ windspeed >= 113 & windspeed <= 136 ~ 4,
+
+ # Hurricane Cate 5
+ windspeed >= 137 ~ 5,
+ ),
line_color = case_when(
# Tropical Depression - Green
@@ -293,19 +310,19 @@ storm_track <- reactive({
storm_status == "TS" ~ "#FFED2C",
# Hurricane Cat 1 - Red
- windspeed >= 64 & windspeed <= 82 ~ "#FF4343",
+ hurricane_category == 1 ~ "#FF4343",
# Hurricane Cat 2 - Pink
- windspeed >= 83 & windspeed <= 95 ~ "#FF6FFF",
+ hurricane_category == 2 ~ "#FF6FFF",
# Hurricane Cat 3 - Magenta
- windspeed >= 96 & windspeed <= 112 ~ "#FF23D3",
+ hurricane_category == 3 ~ "#FF23D3",
# Hurricane Cat 4 - Purple
- windspeed >= 113 & windspeed <= 136 ~ "#C916FF",
+ hurricane_category == 4 ~ "#C916FF",
# Hurricane Cate 5 - White
- windspeed >= 137 ~ "#FFFFFF",
+ hurricane_category == 5 ~ "#FFFFFF",
# Extratropical Cyclone
storm_status == "EX" ~ "#000000",
@@ -329,16 +346,34 @@ storm_track <- reactive({
TRUE ~ "#CCCCCC"
),
line_stroke = case_when(
+
+ # Add dashed lines for certain storm_status
storm_status == "TD" ~ "0",
storm_status == "TS" ~ "0",
storm_status == "HU" ~ "0",
storm_status == "EX" ~ "0",
storm_status == "SD" ~ "0",
storm_status == "SS" ~ "0",
- storm_status == "LO" ~ "5,10",
- storm_status == "WV" ~ "5,10",
- storm_status == "DB" ~ "5,10",
+ storm_status == "LO" ~ "5,5",
+ storm_status == "WV" ~ "5,5",
+ storm_status == "DB" ~ "5,5",
TRUE ~ "0"
+ ),
+ popup_category = case_when(
+ storm_status == "TD" ~ "TD",
+ storm_status == "TS" ~ "TS",
+ hurricane_category == 1 ~ "H1",
+ hurricane_category == 2 ~ "H2",
+ hurricane_category == 3 ~ "H3",
+ hurricane_category == 4 ~ "H4",
+ hurricane_category == 5 ~ "H5",
+ storm_status == "EX" ~ "EX",
+ storm_status == "SD" ~ "SD",
+ storm_status == "SS" ~ "SS",
+ storm_status == "LO" ~ "LO",
+ storm_status == "WV" ~ "WV",
+ storm_status == "DB" ~ "DB",
+ TRUE ~ "NA"
)
) %>%
arrange(datetime)
@@ -406,7 +441,14 @@ output$track_map <- renderLeaflet({
radius = 2,
color = ~line_color,
fillOpacity = 1,
- popup = ~storm_status
+ popup = ~paste0("DATE", "
",
+ datetime, "
",
+ "CATEGORY", "
",
+ popup_category, "
",
+ "WINDSPEED", "
",
+ windspeed, "kt", "
",
+ "PRESSURE", "
",
+ pressure, "mb")
)
landfall_data <- track_data %>%
@@ -422,7 +464,19 @@ output$track_map <- renderLeaflet({
weight = 0,
color = "red",
fillColor = "red",
- fillOpacity = 1
+ fillOpacity = 1,
+ popup = ~paste0("LANDFALL", "
",
+ "DATE", "
",
+ datetime, "
",
+ "CATEGORY", "
",
+ popup_category, "
",
+ "WINDSPEED", "
",
+ windspeed, "kt", "
",
+ "PRESSURE", "
",
+ pressure, "mb", "
",
+ "RMW", "
",
+ rmw, "nm"
+ )
) %>%
addCircles(
data = landfall_data,
@@ -432,7 +486,19 @@ output$track_map <- renderLeaflet({
weight = 2,
color = "red",
fillColor = "red",
- fillOpacity = 0.3
+ fillOpacity = 0.3,
+ popup = ~paste0("LANDFALL", "
",
+ "DATE", "
",
+ datetime, "
",
+ "CATEGORY", "
",
+ popup_category, "
",
+ "WINDSPEED", "
",
+ windspeed, "kt", "
",
+ "PRESSURE", "
",
+ pressure, "mb", "
",
+ "RMW", "
",
+ rmw, "nm"
+ )
)
}