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

Merge branch 'SmallImprovement' into 'master'

Small improvements and bugfixes, mainly in the tijdlijn_alles.

See merge request !12
parents db2b47dc f20465c9
Branches
No related tags found
1 merge request!12Small improvements and bugfixes, mainly in the tijdlijn_alles.
Pipeline #4879 passed
......@@ -45,6 +45,7 @@ doId <- function(input) {
kleurenset_afstanden=c('25'='red', '50'='orange', '100'='yellow', '200'='green', '400'='blue', '800'='purple', '1500'='deeppink1','500'='black')
kleurenset_strokes=c('Backstroke'='red', "Breaststroke"='orange', "Butterfly"="purple", "Freestyle"="green", "Medley"="blue")
kleurenset_pooltypes=c('25m'='orchid', '50m'='cornflowerblue', 'OW'='limegreen')
kleurenset_Pbs=c('Pb'='maroon1', 'noPb'='black')
bron=separate(bron, col = heatType, into = c("hoofdafstand", "heatType"), sep = ", ", fill='left')
bron$heatType <- as.factor(bron$heatType)
......@@ -70,6 +71,7 @@ doId <- function(input) {
bron <- subset(bron, select = -c(minuten, seconden))
bron<-separate(bron, col='city', into=c("MeetId", 'city'), sep=" - ")
bron <-bron[order(bron$date),]
bron$city=trimws(gsub('\\s+', ' ',gsub("-|'", ' ', str_replace_all(bron$city, "\\s", " "))))
zonder_split <- bron[bron$ranking != "Split",]
bovennul<-zonder_split[zonder_split$points !=0,]
......@@ -79,7 +81,8 @@ doId <- function(input) {
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')) %>%
cells = list(values =t(as.matrix(unname(freqtabel))), align='left',
font=list(size=16))) %>%
layout(title = 'Number of meets par city')
appendPlotly(freqtabel_plot)
......@@ -101,14 +104,17 @@ doId <- function(input) {
filter(points == max(points, na.rm = TRUE)) %>%
filter(time == min(time, na.rm=TRUE))
tijdlijn_alles<-ggplot(zonder_split, aes(x=date, y=interaction(distance, stroke, sep='m '), shape=poolType))+
tijdlijntabel=zonder_split %>% group_by(distance, stroke, poolType) %>%
mutate(Pb=ifelse(tijdsduur==min(tijdsduur),'Pb', 'noPb')) %>% arrange(distance, stroke, poolType)
tijdlijn_alles=ggplot(tijdlijntabel, aes(x=date, y=interaction(distance, stroke, sep='m '), color=Pb, shape=poolType))+
geom_point()+
geom_point(data = tabel_Prs, color="green", alpha=0.7, size=2, show.legend=FALSE)+
labs(y='distance & stroke')+ggtitle(" ")+
guides(color='none')+ scale_x_date()+scale_y_discrete(limits=rev)
scale_color_manual(values=kleurenset_Pbs)+theme(legend.position = "none")+
scale_x_date()+scale_y_discrete(limits=rev)
tijdlijn_alles<-ggplotly(tijdlijn_alles, tooltip=c('x', 'shape'), dynamicTicks=TRUE)%>%
layout(title = list(text = paste0('Datum van alle gezwommen slagen per afstand',
'<br>', '<sup>', 'Green: pbs (Dutch: prs)','</sup>')))
'<br>', '<sup>', 'rose: Pbs (inclusive timed disqualifications, exlusive split-times)','</sup>')))
appendPlotly(tijdlijn_alles)
tabel_Prs_small <- bovennul %>%
......@@ -116,12 +122,13 @@ doId <- function(input) {
filter(points == max(points, na.rm = TRUE)) %>%
filter(time == min(time, na.rm=TRUE))
kleurentabel_prs <- ggplot(tabel_Prs_small, aes(distance, stroke)) +
heatmap_prs <- ggplot(tabel_Prs_small, aes(distance, stroke, text=date)) +
geom_tile(aes(fill = points)) +
geom_text(aes(label = points)) +
geom_text(aes(label = points), size=7) +
labs(title = "Heatmap punten per slag en afstand") +
theme_bw()
appendPlot(kleurentabel_prs)
heatmap_prs<-ggplotly(heatmap_prs, tooltip=c('text'))%>%layout(dragmode=FALSE)
appendPlotly(heatmap_prs)
tabel_LastEntrys<-zonder_split%>%
group_by(distance, stroke, poolType) %>%
......@@ -130,10 +137,11 @@ doId <- function(input) {
tabel_lastswam=tabel_LastEntrys%>%select(c('distance', 'stroke', 'poolType', 'date'))
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)),
header = list(values=colnames(tabel_lastswam),font=list(size=16)),
cells=list(values=t(tabel_lastswam[order(tabel_lastswam$date),]),
fill= list(color = list(kleurenset_pooltypes[tabel_lastswam$poolType])),
align='left'))
align='left',
font=list(size=16)))
plottabel_LastSwam<-plottabel_LastSwam %>% layout(title='Last swam par distance and pooltype')
appendPlotly(plottabel_LastSwam)
......@@ -160,7 +168,7 @@ doId <- function(input) {
tabel_lasts=tabel_lasts[tabel_lasts$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, title='Last entrys')
layout(showlegend=FALSE, dragmode=FALSE, title='Last entrys')
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