microsoft / datamations

https://microsoft.github.io/datamations/
Other
67 stars 14 forks source link

Use slider to change tab in Shiny app #56

Closed sharlagelfand closed 3 years ago

sharlagelfand commented 3 years ago

As a next step on #30, looking into if it's possible / how difficult it is to have changing the slider in the datamation update which tab of data is shown in the app.

sharlagelfand commented 3 years ago

I've updated the app with a version that allows the slider to control the tab shown:

https://user-images.githubusercontent.com/15895337/120012711-dba1e600-bfad-11eb-80a0-c6ac3a1a4b26.mov

Some limitations/next steps:

  1. It doesn't show the tabs changing the first time the animation is played - you have to actually manually click through
  2. It would be nice if the opposite worked, e.g. if changing the tabs changed the frame of the animation shown (more difficult because the relationship is not 1-1 e.g. there is only one "group by" tab but many points on the slider that represent that)

cc @jhofman

jhofman commented 3 years ago

just catching this now. it's a great start! a thought: maybe for limitation 2 below we could always go to the "beginning" of a given group-by step?

not sure how to solve limitation 1, seems like it requires some javascript magic. maybe @giorgi-ghviniashvili has some cool hacks?

sharlagelfand commented 3 years ago

The latest version of the app has it so that changing the tabs changes the frame of the animation (to the "beginning" of the group by step, as you suggested @jhofman - thanks!). It's a bit buggy so I'm refining it still - and will continue poking around to see how we might get it working the first time the animation is played through.

sharlagelfand commented 3 years ago

I've implemented it so that the slider updates the tabs, the tabs update the slider, and when the animation actually plays through for the first time / replays, the tabs are also updated. Updated app is here.

@giorgi-ghviniashvili the PR #70 adds to the JS the code to have the animation "play" / "replay" send the slider state to Shiny as well so that I can use it to update the tabs

sharlagelfand commented 3 years ago

Closed fully by #76.