daattali / timevis

📅 Create interactive timeline visualizations in R
http://daattali.com/shiny/timevis-demo/
Other
652 stars 157 forks source link

Navigating timeline with centreItem, setWindow, centreTime seems to not work with groups (Groups dont seem to work either) #64

Closed mstr3336 closed 5 years ago

mstr3336 commented 5 years ago

Hi- I noticed that when using groups, some of my groups only seem to appear on the axis, but aren't actually populated, and navigation/scaling commands such as setWindow, centreItem, centreTime don't really do a bunch. Below is the setup code - I know this isn't fully reproducible, and if you need me to actually construct a reproducible example, I can

Below is an example of the vis being constructed, navigated and displayed. Setup:

# Setup
graph_data <- input %>% 
  transmute(group=PERSON_KEY, start=admit_dttm, end=discharge_dttm,  
            content=ENCNTR_KEY, id = ENCNTR_KEY)
# Setup group labels
person_groups <- graph_data %>% 
  distinct(group) %>% transmute(id = group, content = group)

Now we construct & display the vis

graph <- graph_data %>% timevis::timevis(groups = person_groups)

graph %<>% timevis::setWindow(ymd("2022/04/20"), ymd("2022/04/23"), 
                              options = list(animation = FALSE))
graph

What I notice is: If I include multiple groups, only one group seems to display, (The other appears, but is unpopulated) and navigation doesn't work. If I filter for only a specific value of the grouping variable (One PERSON_KEY), before setting up the group label df, obviously I only see that person's timeline, but navigation works.

Maybe I'm misusing the grouping variable?

mstr3336 commented 5 years ago

I've fixed this problem - Or rather, the problem is fixed on the latest development releases I think it might have been because I was using tibbles, and was running the CRAN distribution of this package. I noticed that there had been a PR/closed issue relating to coercion of tibbles to work in this package, so I installed the development version & loaded that, which seemed to fix basically everything