daattali / timevis

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

long loading time in safari vs chrome #72

Closed yonicd closed 5 years ago

yonicd commented 5 years ago

if i have a 2,300 elements to load into timevis it takes much longer in safari vs chrome

axios <- readRDS('https://github.com/yonicd/potus_public_schedule/raw/master/axios.Rds')

test_background <- axios%>%
  dplyr::mutate(start = DATE_TIME,
                end = DATE_TIME_END,
                style = NA,
                type = 'background',
                dat_type = 'schedule')%>%
  dplyr::select(start,end,type,dat_type,style,TYPE)

test_point <- axios%>%
  dplyr::mutate(start = as.POSIXct(created_at),
                end = as.POSIXct(created_at),
                style = dplyr::case_when(
                  source=="Twitter for iPhone" ~ "background-color: red;",
                  source=="Twitter Media Studio" ~ "background-color: blue;",
                  source=="Twitter for iPad" ~ "background-color: green;"
                  ),
                type = 'background',
                dat_type = 'tweet')%>%
  dplyr::select(start,end,type,dat_type,style,TYPE)

group_data <- axios%>%
  dplyr::select(TYPE)%>%
  dplyr::distinct()%>%
  dplyr::mutate(group=1:dplyr::n())

test <- dplyr::bind_rows(test_background,test_point)%>%dplyr::mutate(id = 1:dplyr::n())

test <- test%>%dplyr::left_join(group_data,by='TYPE')

group_data <- group_data%>%dplyr::rename(content = TYPE,id=group)

timevis::timevis(data = test,groups = group_data)
daattali commented 5 years ago

Have you checked if that's only the case for the R version, or if the javascript library itself has that problem? Most problems reported with timevis are actually issues with the underlying visjs library - that's the first step to check

yonicd commented 5 years ago

My intuition is it is the underlying js lib, but it is weird it isn’t consistent between browsers

daattali commented 5 years ago

You can try to recreate it with js, see this comment for a minimal reprex of js

https://github.com/daattali/timevis/issues/59#issuecomment-457860085

yonicd commented 5 years ago

Ok. I’ll use a bl.ock for it.

yonicd commented 5 years ago

here is the bl.ock

it looks like there is a problem in the js lib in safari with large arrays

https://blockbuilder.org/yonicd/e90dbe83f85d54566b2e77e2883ac243

daattali commented 5 years ago

In that case it should be reported to https://github.com/almende/vis/issues

And my work here is done :)

yonicd commented 5 years ago

for tracking opened issue on vis.js https://github.com/almende/vis/issues/4251