daattali / timevis

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

more than 10 groups #112

Closed cage92606 closed 2 years ago

cage92606 commented 3 years ago

timevis makes great output with groups less than 10. But when the number goes over 10, suddenly there is something wrong on the arrangement of the groups on the output, they are arranged disorderly, not from 1 to n or a to z but randomly or based on some other rules I can't imagine. Here is the example.

timevis(data = data.frame( start = c(Sys.Date(), Sys.Date(), Sys.Date(), Sys.Date(), Sys.Date(), Sys.Date(), Sys.Date(), Sys.Date(), Sys.Date(), Sys.Date() +10, Sys.Date(), Sys.Date(), Sys.Date(), Sys.Date() ), content = c("one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "eleven", "twelve", "thirteen", "fourteen"), group = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14)), groups = data.frame(id = 1:14, content = c("G1", "G2", "G3", "G4", "G5", "G6", "G7", "G8", "G9", "G10", "G11", "G12", "G13", "G14")), options = list(stack = TRUE) ) %>% setGroups(data.frame(id = 1:14, content = c("Group 1", "Group 2", "Group 3", "Group 4", "Group 5", "Group 6", "Group 7", "Group 8", "Group 9", "Group 10", "Group 11", "Group 12", "Group 13", "Group 14")))

daattali commented 3 years ago

Did you verify that this is a problem with the {timevis} R package, and not with the underlying visjs Timelie javascript library? If not, please try to crate this example with the javascript library. If it works there but not in R, then this is indeed a timevis issue.

cage92606 commented 3 years ago

Hi. I tested with visjs and I got the same result :<, but fixed using groupOrder option :). is there groupOrder option on timevis R package? Thank you.

daattali commented 3 years ago

The answer is similar to before: the timevis package is simply a way to use visjs from shiny. I don't know what all the options are, and this package doesn't explicitly support any option - whatever is available in visjs version 4.16.1 should work.

I can see this old thread about grouporder that may be useful https://github.com/daattali/timevis/issues/14