---
output:
html_document:
code_folding: hide
---
```{r block2, warning=FALSE, message=FALSE, fig.width=fig.1.width, fig.height=fig.1.height, dev='svg'}
library(vistime)
library(ggplot2)
inputdata <- INPUTDATAFRAME
maxlength=0
for (fmt in c("%Y-%m-%d","%y-%m-%d","%Y/%m/%d","%y/%m/%d","%m-%d-%Y","%m-%d-%y","%m/%d/%y","%m/%d/%Y","%d%b%Y","%d%b%y")) {
len = length(na.omit(as.Date(inputdata$vistime.start,format=fmt,optional=TRUE)))
if (len > maxlength) {
maxlength = len
datefmt = fmt
}
}
inputdata$vistime.start <- as.Date(inputdata$vistime.start,format=datefmt,optional=TRUE)
inputdata$vistime.end <- as.Date(inputdata$vistime.end,format=datefmt,optional=TRUE)
plot <- gg_vistime(inputdata,events="vistime.events",groups="vistime.groups",start="vistime.start",end="vistime.end") + theme(axis.text=element_text(size=12,face="bold"))
print(plot)