---
title: "Računalna grafika 2025/2026"
output:
flexdashboard::flex_dashboard:
orientation: columns
vertical_layout: fill
source_code: embed
---
```{css, echo=FALSE}
.sidebar { overflow: auto; }
.dataTables_scrollBody {
height:95% !important;
max-height:95% !important;
}
.chart-stage-flex {
overflow:auto !important;
}
```
```{r setup, include=FALSE}
library(tidyverse)
library(kableExtra)
studenti <- read_csv("RG2025_studenti.csv") %>% unite("student", Prezime, Ime, sep=" ") %>%
mutate(student = as.factor(student))
datum1 <- seq(dmy('16-10-2025'), dmy('17-11-2025'), by = 'weeks') %>% format('%d-%m-%Y')
datum2 <- seq(dmy('27-11-2025'), dmy('21-12-2025'), by = 'weeks') %>% format('%d-%m-%Y')
datum3 <- seq(dmy('08-01-2026'), dmy('19-01-2026'), by = 'weeks') %>% format('%d-%m-%Y')
datumi <- c(datum1, datum2, datum3)
dolasci <- list.files("./dolasci", full.names = TRUE)
redni_broj <- as.integer(dolasci %>% str_extract("\\d+"))
dolasci <- dolasci %>%
map_dfr(~as_tibble_col(readLines(.x) %>% str_extract("(?<=\\s).*(?=\\s)"),
column_name = "student"), .id = "id") %>%
mutate(datum = factor(datumi[redni_broj[as.integer(id)]], levels = datumi),
student = factor(student, levels = studenti$student))
tablica <- dolasci %>% count(student, datum, .drop = FALSE) %>%
pivot_wider(names_from = datum, values_from = n) %>%
mutate(UKUPNO = rowSums(across(where(is.numeric))))
```
Dolasci
=======================================================================
## Column 1
### Dolasci na labose po datumima
```{r fig.width=11}
ggplot(dolasci, aes(x = student, y = datum)) +
geom_point(size = 5, shape = 21, fill = "#f7dc6f",
color = "skyblue3", stroke = 1) +
scale_x_discrete(drop = FALSE) + scale_y_discrete(drop = FALSE) +
xlab("") + ylab("") +
theme(axis.text.x = element_text(angle = 45, vjust = 1, hjust=1))
```
Ukupni dolasci
=======================================================================
## Column 1
### Ukupni dolasci na labose
```{r fig.width=11}
ggplot(dolasci %>% count(student), aes(x = student, y = n)) +
geom_col(fill="skyblue3", width = 0.8, alpha = 0.9) + xlab("") + ylab("") +
geom_label(aes(label = n), vjust = 1.3,
fill="lightyellow", color = "blue", size = 3) +
scale_x_discrete(drop = FALSE) +
scale_y_continuous(breaks = 0:11, limits = c(0,11.5), expand = c(0, 0)) +
theme(axis.text.x = element_text(angle = 45, vjust = 1, hjust=1))
```
Tablica
=======================================================================
### Tablica dolazaka po datumima
```{r}
knitr::kable(tablica, align = c('l', rep('c', length(datumi) + 1))) %>%
kable_paper("hover", full_width = FALSE, fixed_thead = TRUE) %>%
column_spec(13, background = "#2e86c1", color = "white", bold = TRUE,
include_thead = TRUE)
```