# presidents and vice presidents
pres <- data.frame(
Position = rep(c("President", "Vice"), each = 3),
Name = c("Washington", rep(c("Adams", "Jefferson"), 2), "Burr"),
start = c("1789-03-29", "1797-02-03", "1801-02-03"),
end = c("1797-02-03", "1801-02-03", "1809-02-03"),
color = c("#cbb69d", "#603913", "#c69c6e")
)
hc_vistime(pres, col.event = "Position", col.group = "Name", title = "Presidents of the USA")
#'
if (FALSE) {
# ------ It is possible to change all attributes of the timeline using highcharter::hc_*():
data <- read.csv(text="event,start,end
Phase 1,2020-12-15,2020-12-24
Phase 2,2020-12-23,2020-12-29
Phase 3,2020-12-28,2021-01-06
Phase 4,2021-01-06,2021-02-02")
library(highcharter)
p <- hc_vistime(data, optimize_y = T, col.group = "event",
title = "Highcharts customization example")
p %>% hc_title(style = list(fontSize=30)) %>%
hc_yAxis(labels = list(style = list(fontSize=30, color="violet"))) %>%
hc_xAxis(labels = list(style = list(fontSize=30, color="red"), rotation=30)) %>%
hc_chart(backgroundColor = "lightgreen")
}
Run the code above in your browser using DataLab