Closed Churongxu closed 4 years ago
I'm not able to run your example code. Please provide fully reproducible code.
library(lubridate) library(tidyverse) library(timevis)
start = Sys.Date() + c(rep(1,3), rep(22,3), rep(42,6)) timedata <- data.frame( id = 1:12, start = start, end = start +days(20), group = c(rep(1,12)), content = c("event 1.1", "event 1.2", "event 1.3", "event 2.1", "event 2.2", "event 2.3", "event 3.1", "event 3.2", "event 3.3","event 3.4", "event 3.5", "event 3.6"), subgroup = c(1,2,3,1,2,3,1,2,3,4,5,6) )
groups <- data.frame( id = timedata$group, content = timedata$group) %>% as_tibble() %>% unique()
timevis::timevis(data =timedata, groups = groups, options = list(stack = FALSE))
The boxes "disappear" because they have the exact same dates and same subgroup and you explicitly use code to disable stacking. Change the stack = FALSE
to stack = TRUE
Actually, I have tried stack in either direction. I even have tried different subgroup frame as belows, the output still looks like this. What I really want is no space in one column, for example, I want event 3 series start from the origin, and there is no space between event 3.3 and 3.4.
subgroup = c(1,1,1,2,2,2,3,3,3,3,3,3) subgroup = c(1,2,3,1,2,3,1,2,3,4,5,6) subgroup = c(1,2,3,4,5,6,7,8,9,10,11,12)
This is what you original code looks like to me when I turn stacking on
If this is not what you want, then perhaps what you want is not doable with the library. It certainly doesn't seem like a timevis issue. You can look at the documentation for the javascript library and see if it supports exactly what you're trying to do https://almende.github.io/vis/docs/timeline/ If it's supported in the javascript then it should be doable using timevis as well
Hi all, I come across a problem when using subgroup and options (stack/stackSubgroups). When I run the following small example, event series 3 only shows 3.1/3.1/3.3/3.6 and 3.4/3.5 disappears. I would like boxes in the same column stack on each other one by one.
timedata <- data.frame( id = 1:12, start = Sys.Date() + c(rep(1,3), rep(22,3), rep(42,6)), end = start +days(20), group = c(rep(1,12)), content = c("event 1.1", "event 1.2", "event 1.3", "event 2.1", "event 2.2", "event 2.3", "event 3.1", "event 3.2", "event 3.3","event 3.4", "event 3.5", "event 3.6"), subgroup = c(1,2,3,1,2,3,1,2,3,4,5,6) )
groups <- data.frame( id = timedata$group, content = timedata$group) %>% as_tibble() %>% unique()
timevis::timevis(data =timedata, groups = groups, options = list(stack = FALSE))