---
title: "test"
toc: true
---
```{r}
library(tidyverse)
library(jsonlite)
library(statgl)
```
```{r}
# 1. Fetch data
df <- statgl_fetch("END1MID", time = px_top(), measuring = c(1, 2),
.col_code = TRUE, .val_code = "measuring"
)
# 2. Extract unique factors cleanly
stations <- unique(df$`weather station`) %>% fct_inorder()
```
{{< filter
id="station"
label="Lokalitet"
options='`r toJSON(stations)`'
all_label="Alle lokaliteter"
>}}
```{r}
p <- statgl_fetch("END1MID",
time = px_top(10), measuring = 0, .val_code = "month", .col_code = TRUE
) %>%
mutate(date = as.Date(sprintf("%s-%02d-01", time, month + 1))) %>%
statgl_plot(
date, group = `weather station`, palette = "green", digits = 1,
suffix = "°C", series_tags = list(station = "weather station"),
legend_position = "right"
)
```
{{< shorty
plot = '`r p`'
filter_series = "station"
>}}