daattali / timevis

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

Shiny input variable of visible items in timeline #22

Closed padamson closed 4 years ago

padamson commented 7 years ago

Create a Shiny input variable of items visible in the timeline. Use visjs method getVisibleItems() to populate a vector of IDs inside a timeline.on(‘rangechanged’… listener.

Something like:

// The range of the window has changes (by dragging or zooming)                                             
timeline.on('rangechanged', function (properties) {
  Shiny.onInputChange(
    elementId + "_visible",
    timeline.getVisibleItems()
  );
});
Shiny.onInputChange(
  elementId + "_visible",
  timeline.getVisibleItems()
);
daattali commented 7 years ago

Thanks Paul

It should also be returned when the items data gets changed (if an item is added/removed/modified and affects the currently visible items)

I didn't add this functionality originally because I wanted to only expose what I thought are the most useful pieces of data. If others +1 this issue and also find it useful, we'll add it

daattali commented 4 years ago

@padamson you probably don't care anymore, but this is implemented :)