Skip to content
Snippets Groups Projects
Commit 0a33c871 authored by Ruben van Dijk's avatar Ruben van Dijk
Browse files

Merge branch 'betereTabellen' into 'master'

Changed and added tables.

See merge request !14
parents d8d9a926 bd5a554a
Branches
No related tags found
1 merge request!14Changed and added tables.
Pipeline #7938 passed
FROM ubuntu:22.10 AS base
FROM ubuntu:22.04 AS base
RUN apt-get update && DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get install -y --no-install-recommends r-base-core && apt-get clean
FROM base AS libraries
......
......@@ -24,6 +24,17 @@ doId <- function(input) {
appendPlot <- function(item) {
appendPlotly(ggplotly(item))
}
lettergrootte=18
regelhoogte=23
plot_tabel<-function(input_tabel){
kolombreedte=unname(sapply(input_tabel, function(x) max(nchar(as.character(x)))))
kolombreedte2=nchar(colnames(input_tabel))
kolombreedte_totaal=pmax(kolombreedte, kolombreedte2)
tabel_als_plot<-plot_ly(type = 'table', columnwidth=kolombreedte_totaal,
header = list(values=colnames(input_tabel),font=list(size=lettergrootte)),
cells = list(values =t(input_tabel),font=list(size=lettergrootte), height=regelhoogte))
return(tabel_als_plot)}
dates_to_drop=as.list(strsplit(dates_to_drop, ","))[[1]]
dates_to_drop=strptime(dates_to_drop, format="%Y-%m-%d")
dates_to_drop=ymd(dates_to_drop)
......@@ -75,27 +86,29 @@ doId <- function(input) {
bron <-bron[order(bron$date),]
bron$city=trimws(gsub('\\s+', ' ',gsub("-|'", ' ', str_replace_all(bron$city, "\\s", " "))))
bron$city<-paste(toupper(substr(bron$city, 1, 1)), substr(bron$city, 2, nchar(bron$city)), sep="")
zonder_split <- bron[bron$ranking != "Split",]
zonder_split <- bron[bron$ranking != "Split",]#So even if your splittime is a Pb, it is not displayed by this application.
bovennul<-zonder_split[zonder_split$points !=0,]
DateAndPool<-bron %>%select('city', 'MeetId', 'date') %>%unique() %>% select('city', 'date')
DateAndPool<-DateAndPool[order(DateAndPool$date),]
freqtabel=as.data.frame(table(DateAndPool$city))
freqtabel=freqtabel[order(freqtabel$Freq, decreasing=TRUE),]
kolombreedte=unname(sapply(freqtabel, function(x) max(nchar(as.character(x)))+5))
freqtabel_plot<-plot_ly(type = 'table', columnwidth=kolombreedte,
cells = list(values =t(as.matrix(unname(freqtabel))), align='left',
font=list(size=16))) %>%
layout(title = 'Number of meets par city')
appendPlotly(freqtabel_plot)
plotfreq=DateAndPool %>% group_by(city) %>% mutate(count=row_number())
tussentabel=plotfreq %>% group_by(city) %>% filter(count==max(count))
tussentabel$date=max(plotfreq$date)
plotfreq=rbind(plotfreq, tussentabel)
CountsParPool_dates=ggplot(plotfreq, aes(x=date, y=count, color=city))+geom_step()+
labs(title='Cumulative number of meets par city')
CountsParPool_dates<-ggplotly(CountsParPool_dates, dynamicTicks=TRUE)
appendPlotly(CountsParPool_dates)
freqtabel=tussentabel%>%select(c('city', 'count'))
freqtabel=freqtabel[order(freqtabel$count, decreasing=TRUE),]
freqtabel_plot=plot_tabel(freqtabel)%>% layout(title = 'Number of meets par city')
appendPlotly(freqtabel_plot)
CountsParAfstandSlag_dates=bron %>% group_by(AfstandSlag) %>% mutate(count=row_number())
tussentabel=CountsParAfstandSlag_dates%>%group_by(AfstandSlag)%>%filter(count==max(count))
tussentabel$date=max(CountsParAfstandSlag_dates$date)
CountsParAfstandSlag_dates=rbind(CountsParAfstandSlag_dates, tussentabel)
Plot_CountsParAfstandSlag_dates=ggplot(CountsParAfstandSlag_dates, aes(x=date, y=count, text=AfstandSlag,
color=interaction(distance, stroke, sep="m ")))+
geom_step()+labs(color='Afstand & Slag', title='Cumulative count par distance/stroke')
......@@ -135,19 +148,41 @@ doId <- function(input) {
appendPlotly(heatmap_prs)
tabel_LastEntrys<-zonder_split%>%
group_by(distance, stroke, poolType, Lap) %>%
filter(Lap==FALSE)%>%
group_by(distance, stroke, poolType) %>%
filter(date == max(date, na.rm=TRUE))
tabel_lastswam=tabel_LastEntrys%>%select(c('distance', 'stroke', 'poolType', 'date', 'Lap'))
kolombreedte=unname(sapply(tabel_lastswam, function(x) max(nchar(as.character(x)))+5))
plottabel_LastSwam=plot_ly(type='table', columnwidth=kolombreedte,
header = list(values=colnames(tabel_lastswam),font=list(size=16)),
cells=list(values=t(tabel_lastswam[order(tabel_lastswam$date),]),
for (pooltype_loop in unique(tabel_LastEntrys$poolType)){
title_plot=paste("Last date swam - ", pooltype_loop, 'pool')
heatmap_lastswam=ggplot(tabel_LastEntrys[tabel_LastEntrys$poolType==pooltype_loop,],
aes(distance, stroke, text=date)) +
geom_tile(aes(fill = date)) + geom_text(aes(label = format(date, format="%e %b\n%Y")), size=4) +
labs(title = title_plot)+ theme_bw()
heatmap_lastswam=ggplotly(heatmap_lastswam, tooltip=FALSE)%>%
layout(dragmode=FALSE)
appendPlotly(heatmap_lastswam)
}
tabel_lastswam=tabel_LastEntrys%>%select(c('distance', 'stroke', 'poolType', 'date'))
kolombreedte=unname(sapply(tabel_lastswam, function(x) max(nchar(as.character(x)))))
kolombreedte2=nchar(colnames(tabel_lastswam))
kolombreedte_totaal=pmax(kolombreedte, kolombreedte2)
plottabel_LastSwam=plot_ly(type='table', columnwidth=kolombreedte_totaal,
header = list(values=colnames(tabel_lastswam),font=list(size=lettergrootte)),
cells=list(values=t(tabel_lastswam),
fill= list(color = list(kleurenset_pooltypes[tabel_lastswam$poolType])),
align='left',
font=list(size=16)))
plottabel_LastSwam<-plottabel_LastSwam %>% layout(title='Last swam par distance and pooltype')
align=c('right', 'middle', 'middle', 'middle'),
height=regelhoogte,
font=list(size=lettergrootte)))
plottabel_LastSwam<-plottabel_LastSwam%>% layout(title='Last swam par distance and pooltype - no Laptimes')
appendPlotly(plottabel_LastSwam)
for (pooltype_loop in unique(tabel_LastEntrys$poolType)){
title_plot=paste("Last swam par distance and stroke - no Laptimes' - ", pooltype_loop, 'pool')
tabel_lastswam=tabel_LastEntrys[tabel_LastEntrys$poolType==pooltype_loop,]%>%ungroup()
tabel_lastswam=tabel_lastswam%>%select(c('distance', 'stroke', 'date'))
plottabel_LastSwam<-plot_tabel(tabel_lastswam)%>% layout(title=title_plot)
appendPlotly(plottabel_LastSwam)
}
breedte_perslag=unique(tabel_Prs_metpooltype[, c('distance', 'stroke')]) %>% group_by(stroke) %>%count()
breedte_perslag=breedte_perslag$n
......@@ -171,7 +206,7 @@ doId <- function(input) {
tabel_lasts=tabel_LastEntrys[order(tabel_LastEntrys$poolType),]%>%filter(points!=0)
facetwrap_lasts=tabel_lasts %>% split(.$stroke) %>%map(barplot_facets)
facetwrap_lasts=facetwrap_lasts %>% subplot(widths=breedte_perslag, margin=0.01, shareY=TRUE) %>%
layout(showlegend=FALSE, dragmode=FALSE, title='Last entrys. Points >0, so no laptimes, 25m-times, disqualifiactions etc.')
layout(showlegend=FALSE, dragmode=FALSE, title='Last entrys. Only points >0, and no laptimes.')
appendPlotly(facetwrap_lasts)
stippenplot_sizes<-ggplot(bovennul, aes(x=date, y=points, color=stroke, size=distance, group=AfstandSlag))+
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment