I'm using the package 'timevis' to create a timeline in my RShiny dashboard app. I want to visualize some planned deadlines of when to check machines for their maintenance. In the timeline, both executed checks and planned checks are visible. To visualize these different checks, I want to give it different colors (green for executed and red for planned). I succeeded to do this in a test environment, but when I copy the code in my dashboard, the colors are not visible (all blocks are just standard blue).
This is my code: test:
timevisData <- data.frame(content = tijdlijntabel$machine_nr,
start = tijdlijntabel$onderhoud_datum,
group = tijdlijntabel$onderhoud_type,
style = tijdlijntabel$style)
groups <- data.frame(id = c("Klep", "Reinigen", "Zeeppomp"), content = c("Klep", "Reinigen", "Zeeppomp"))
timevis(data = timevisData, groups = groups, showZoom = TRUE, options = list(editable = TRUE)) %>%
setWindow(Sys.Date() %m-% months(1), Sys.Date() %m+% months(1))
The timevisData dataframe contains: the machine_nr (displayed in the timeline blocks), the date of the check, the type of check (3 types of checks) and the style (the color: "border-color: red; color: white; background-color: red" or "border-color: green; color: white; background-color: green"). In this screenshot, the first part of the data is shown: enter image description here
This is an example of how I want my timeline to be in the dashboard: enter image description here
This is the code of my dashboard: ui.R:
fluidPage(
h3("Overzicht uitgevoerde en voorgestelde onderhoudsbeurten"),
timevisOutput("timeline_aalst")
),
server.R:
output$timeline_aalst <- renderTimevis({
groups <- data.frame(id = c("Klep", "Reinigen", "Zeeppomp"), content = c("Klep", "Reinigen", "Zeeppomp"))
timevis(data = timevisData, groups = groups, showZoom = TRUE, options = list(editable = TRUE)) %>%
setWindow(Sys.Date() %m-% months(1), Sys.Date() %m+% months(1))
})