Upload 2 files
Browse files- depth_interactive_map_alpha.R +31 -31
- styles.css +10 -1
depth_interactive_map_alpha.R
CHANGED
|
@@ -1555,12 +1555,16 @@ LUCIDE_JS <- tags$head(
|
|
| 1555 |
var becameVisible = stripVisible &&
|
| 1556 |
(!strip || strip.style.display !== 'flex');
|
| 1557 |
if (strip) strip.style.display = stripVisible ? 'flex' : 'none';
|
| 1558 |
-
// First time the strip is shown in this session
|
| 1559 |
-
// play placeholder swaps into an SVG,
|
| 1560 |
-
//
|
|
|
|
| 1561 |
if (becameVisible) {
|
| 1562 |
if (window.lucide) setTimeout(function() { lucide.createIcons(); }, 30);
|
| 1563 |
onTemporalSliderInput();
|
|
|
|
|
|
|
|
|
|
| 1564 |
}
|
| 1565 |
// Tell Shiny which layers the chart should draw (server reactive)
|
| 1566 |
if (typeof Shiny !== 'undefined') {
|
|
@@ -2756,7 +2760,7 @@ ui <- page_fillable(
|
|
| 2756 |
`aria-label` = "Temporal month-year range filter",
|
| 2757 |
div(class = "temporal-strip-chart",
|
| 2758 |
plotOutput("temporal_strip_chart",
|
| 2759 |
-
width = "100%", height = "
|
| 2760 |
div(class = "temporal-strip-controls",
|
| 2761 |
tags$button(id = "temporal-play-btn",
|
| 2762 |
type = "button",
|
|
@@ -4424,9 +4428,9 @@ server <- function(input, output, session) {
|
|
| 4424 |
output$temporal_ged <- make_temporal_yr("ged_events", "year", COL_LIGHT_BLUE)
|
| 4425 |
|
| 4426 |
# --- Temporal strip chart (bottom-of-map month-year range filter) -----------
|
| 4427 |
-
#
|
| 4428 |
-
#
|
| 4429 |
-
#
|
| 4430 |
output$temporal_strip_chart <- renderPlot({
|
| 4431 |
active <- input$temporal_active %||% character(0)
|
| 4432 |
if (length(active) == 0) return(NULL)
|
|
@@ -4434,45 +4438,41 @@ server <- function(input, output, session) {
|
|
| 4434 |
df_all <- .APP_CACHE$temporal[[primary_id]]
|
| 4435 |
if (is.null(df_all) || nrow(df_all) == 0) return(NULL)
|
| 4436 |
info <- TEMPORAL_LAYERS[[primary_id]]
|
| 4437 |
-
|
| 4438 |
|
| 4439 |
ym_range <- TEMPORAL_RANGE
|
| 4440 |
pl <- input$temporal_filter
|
| 4441 |
ym_lo <- if (is.null(pl)) ym_range[1] else (pl$start %||% ym_range[1])
|
| 4442 |
ym_hi <- if (is.null(pl)) ym_range[2] else (pl$end %||% ym_range[2])
|
| 4443 |
-
|
| 4444 |
|
| 4445 |
-
# Year-only x ticks
|
| 4446 |
yr_lo <- ym_range[1] %/% 12L
|
| 4447 |
yr_hi <- ym_range[2] %/% 12L
|
| 4448 |
-
yr_seq <- seq(yr_lo, yr_hi,
|
|
|
|
| 4449 |
yr_breaks <- yr_seq * 12L
|
| 4450 |
yr_labels <- as.character(yr_seq)
|
| 4451 |
|
| 4452 |
-
|
| 4453 |
-
|
| 4454 |
-
|
| 4455 |
-
|
| 4456 |
-
p <- p + geom_line(data = df_sel, aes(x = ym, y = n),
|
| 4457 |
-
color = line_color, linewidth = 1.1)
|
| 4458 |
-
|
| 4459 |
-
p +
|
| 4460 |
scale_x_continuous(breaks = yr_breaks, labels = yr_labels,
|
| 4461 |
limits = c(ym_range[1] - 0.5, ym_range[2] + 0.5),
|
| 4462 |
expand = expansion(mult = c(0, 0))) +
|
| 4463 |
-
scale_y_continuous(expand = expansion(mult = c(0, 0.
|
| 4464 |
labs(x = NULL, y = NULL) +
|
| 4465 |
-
theme_minimal(base_size =
|
| 4466 |
-
theme(plot.background
|
| 4467 |
-
panel.background
|
| 4468 |
-
panel.grid
|
| 4469 |
-
|
| 4470 |
-
axis.
|
| 4471 |
-
axis.text.
|
| 4472 |
-
axis.
|
| 4473 |
-
|
| 4474 |
-
|
| 4475 |
-
plot.margin = margin(1, 6, 1, 6))
|
| 4476 |
}, bg = "transparent", res = 110)
|
| 4477 |
|
| 4478 |
# PAM month-window re-aggregation: when the strip range changes and PAM is
|
|
|
|
| 1555 |
var becameVisible = stripVisible &&
|
| 1556 |
(!strip || strip.style.display !== 'flex');
|
| 1557 |
if (strip) strip.style.display = stripVisible ? 'flex' : 'none';
|
| 1558 |
+
// First time the strip is shown in this session: refresh Lucide so the
|
| 1559 |
+
// play placeholder swaps into an SVG, force the label + fill to reflect
|
| 1560 |
+
// the current slider values, and dispatch a resize so Shiny re-measures
|
| 1561 |
+
// the plotOutput (it was 0-width while the strip was display:none).
|
| 1562 |
if (becameVisible) {
|
| 1563 |
if (window.lucide) setTimeout(function() { lucide.createIcons(); }, 30);
|
| 1564 |
onTemporalSliderInput();
|
| 1565 |
+
setTimeout(function() {
|
| 1566 |
+
window.dispatchEvent(new Event('resize'));
|
| 1567 |
+
}, 60);
|
| 1568 |
}
|
| 1569 |
// Tell Shiny which layers the chart should draw (server reactive)
|
| 1570 |
if (typeof Shiny !== 'undefined') {
|
|
|
|
| 2760 |
`aria-label` = "Temporal month-year range filter",
|
| 2761 |
div(class = "temporal-strip-chart",
|
| 2762 |
plotOutput("temporal_strip_chart",
|
| 2763 |
+
width = "100%", height = "52px")),
|
| 2764 |
div(class = "temporal-strip-controls",
|
| 2765 |
tags$button(id = "temporal-play-btn",
|
| 2766 |
type = "button",
|
|
|
|
| 4428 |
output$temporal_ged <- make_temporal_yr("ged_events", "year", COL_LIGHT_BLUE)
|
| 4429 |
|
| 4430 |
# --- Temporal strip chart (bottom-of-map month-year range filter) -----------
|
| 4431 |
+
# Honeycomb-style: monthly bars across the full timespan, dim outside the
|
| 4432 |
+
# selected window and saturated inside it. Single layer (most-recently
|
| 4433 |
+
# toggled). No y-axis, no legend, compact theme.
|
| 4434 |
output$temporal_strip_chart <- renderPlot({
|
| 4435 |
active <- input$temporal_active %||% character(0)
|
| 4436 |
if (length(active) == 0) return(NULL)
|
|
|
|
| 4438 |
df_all <- .APP_CACHE$temporal[[primary_id]]
|
| 4439 |
if (is.null(df_all) || nrow(df_all) == 0) return(NULL)
|
| 4440 |
info <- TEMPORAL_LAYERS[[primary_id]]
|
| 4441 |
+
bar_color <- info$color
|
| 4442 |
|
| 4443 |
ym_range <- TEMPORAL_RANGE
|
| 4444 |
pl <- input$temporal_filter
|
| 4445 |
ym_lo <- if (is.null(pl)) ym_range[1] else (pl$start %||% ym_range[1])
|
| 4446 |
ym_hi <- if (is.null(pl)) ym_range[2] else (pl$end %||% ym_range[2])
|
| 4447 |
+
df_all$in_win <- df_all$ym >= ym_lo & df_all$ym <= ym_hi
|
| 4448 |
|
| 4449 |
+
# Year-only x ticks across the full slider span.
|
| 4450 |
yr_lo <- ym_range[1] %/% 12L
|
| 4451 |
yr_hi <- ym_range[2] %/% 12L
|
| 4452 |
+
yr_seq <- seq(yr_lo, yr_hi,
|
| 4453 |
+
by = if (yr_hi - yr_lo > 12) 2L else 1L)
|
| 4454 |
yr_breaks <- yr_seq * 12L
|
| 4455 |
yr_labels <- as.character(yr_seq)
|
| 4456 |
|
| 4457 |
+
ggplot(df_all, aes(x = ym, y = n, fill = in_win)) +
|
| 4458 |
+
geom_col(width = 1, color = NA) +
|
| 4459 |
+
scale_fill_manual(values = c(`FALSE` = "#ffffff22",
|
| 4460 |
+
`TRUE` = bar_color)) +
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4461 |
scale_x_continuous(breaks = yr_breaks, labels = yr_labels,
|
| 4462 |
limits = c(ym_range[1] - 0.5, ym_range[2] + 0.5),
|
| 4463 |
expand = expansion(mult = c(0, 0))) +
|
| 4464 |
+
scale_y_continuous(expand = expansion(mult = c(0, 0.05))) +
|
| 4465 |
labs(x = NULL, y = NULL) +
|
| 4466 |
+
theme_minimal(base_size = 8) +
|
| 4467 |
+
theme(plot.background = element_rect(fill = "transparent", color = NA),
|
| 4468 |
+
panel.background = element_rect(fill = "transparent", color = NA),
|
| 4469 |
+
panel.grid = element_blank(),
|
| 4470 |
+
axis.title = element_blank(),
|
| 4471 |
+
axis.text.x = element_text(size = 7.5, color = "#94a3b8"),
|
| 4472 |
+
axis.text.y = element_blank(),
|
| 4473 |
+
axis.ticks = element_blank(),
|
| 4474 |
+
legend.position = "none",
|
| 4475 |
+
plot.margin = margin(0, 4, 0, 4))
|
|
|
|
| 4476 |
}, bg = "transparent", res = 110)
|
| 4477 |
|
| 4478 |
# PAM month-window re-aggregation: when the strip range changes and PAM is
|
styles.css
CHANGED
|
@@ -2509,6 +2509,9 @@ body.tooltips-off .maplibregl-popup { display: none !important; }
|
|
| 2509 |
display: flex;
|
| 2510 |
flex-direction: column;
|
| 2511 |
gap: 4px;
|
|
|
|
|
|
|
|
|
|
| 2512 |
pointer-events: auto;
|
| 2513 |
}
|
| 2514 |
|
|
@@ -2522,9 +2525,15 @@ body.tooltips-off .maplibregl-popup { display: none !important; }
|
|
| 2522 |
|
| 2523 |
.temporal-strip-chart {
|
| 2524 |
width: 100%;
|
|
|
|
|
|
|
| 2525 |
}
|
| 2526 |
-
.temporal-strip-chart .shiny-plot-output
|
|
|
|
| 2527 |
background: transparent;
|
|
|
|
|
|
|
|
|
|
| 2528 |
}
|
| 2529 |
|
| 2530 |
.temporal-strip-controls {
|
|
|
|
| 2509 |
display: flex;
|
| 2510 |
flex-direction: column;
|
| 2511 |
gap: 4px;
|
| 2512 |
+
/* Honeycomb-style: keep the chart inside the rounded card no matter what
|
| 2513 |
+
Shiny does with the plotOutput dimensions on first render. */
|
| 2514 |
+
overflow: hidden;
|
| 2515 |
pointer-events: auto;
|
| 2516 |
}
|
| 2517 |
|
|
|
|
| 2525 |
|
| 2526 |
.temporal-strip-chart {
|
| 2527 |
width: 100%;
|
| 2528 |
+
height: 52px;
|
| 2529 |
+
overflow: hidden;
|
| 2530 |
}
|
| 2531 |
+
.temporal-strip-chart .shiny-plot-output,
|
| 2532 |
+
.temporal-strip-chart .shiny-plot-output > img {
|
| 2533 |
background: transparent;
|
| 2534 |
+
width: 100% !important;
|
| 2535 |
+
height: 52px !important;
|
| 2536 |
+
display: block;
|
| 2537 |
}
|
| 2538 |
|
| 2539 |
.temporal-strip-controls {
|