Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Timer Events and Animations #4060

Open
domoritz opened this issue Jul 19, 2018 · 16 comments
Open

Support Timer Events and Animations #4060

domoritz opened this issue Jul 19, 2018 · 16 comments

Comments

@domoritz
Copy link
Member

domoritz commented Jul 19, 2018

It would be great if we could create animated charts with Vega-Lite. Note that I do not mean animated transitions during interactions (which need Vega support first vega/vega#641).

Vega has support for timer event streams. These event streams can be used to create animations that play once or repeat.

Use cases

Proposal

{
  "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
  "data": {
    "url": "data.json"
  },
  "mark": "bar",
  "encoding": {
    "x": {"field": "a", "type": "ordinal"},
    "y": {"field": "b", "type": "quantitative"},
	"frame": {"field": "time", "type": "ordinal", "interval": 1000},
    "key": {"field": "a", "type": "ordinal"}
  }
}

frame here defines an animation frame or step. The key channel is used to identify the same mark across frames. This is particularly interesting for points that move through the x/y space. Until we have transitions (needs Vega support), this is less relevant, though.

  • We only support ordinal (iterate through) and quantitative (do we need a step size?).
  • How should users define an interval?

Competing approaches

Expressions

An alternative to the time channel is writing timers in expressions.

Others?

@domoritz domoritz added RFC / Discussion 💬 For discussing proposed changes 🙋 Feature Request labels Jul 19, 2018
@g3o2
Copy link
Contributor

g3o2 commented Jul 19, 2018

Is timer more like an encoding or more like a selection/interaction?

@kanitw kanitw added this to the x.x Visual Encoding Patches milestone Jul 20, 2018
@kanitw kanitw changed the title Time channel Support Timer Events Jul 28, 2018
@domoritz domoritz changed the title Support Timer Events Support Timer Events and Animations Oct 28, 2019
@kanitw kanitw removed this from the x.x Visual Encoding milestone Dec 4, 2019
@shenenya
Copy link

shenenya commented Jan 6, 2020

Is there any progress on this? Thanks.

@domoritz
Copy link
Member Author

domoritz commented Oct 29, 2020

http://www.ycwu.org/Files/Data-GIF.pdf gives a good overview over the design space.

Screen Shot 2020-10-29 at 10 06 39

@joelostblom
Copy link
Contributor

I just stumbled upon Gemini, which looks really cool! Is the plan to support animations directly from the VL spec in the future via Gemini?

@domoritz
Copy link
Member Author

domoritz commented Jun 6, 2021

We do plan to add animation support without recommendation but probably not via Gemini but native Vega support.

@domoritz
Copy link
Member Author

This idea is implemented in Animated Vega-Lite: https://arxiv.org/abs/2208.03869.

@PBI-David
Copy link
Contributor

PBI-David commented Oct 19, 2022

Moving examples can be found here. This looks amazing. When will this be merged into the Vega-Lite codebase?

http://vis.csail.mit.edu/pubs/animated-vega-lite/

@PButcher
Copy link

This idea is implemented in Animated Vega-Lite: https://arxiv.org/abs/2208.03869.

From their conclusion:

To support this future research, we intend to contribute our work back to the open source Vega-Lite project.

🎉🎉🎉

@domoritz
Copy link
Member Author

We're working on a plan to create prs to add the features from the paper to Vega-Lite.

@gut4
Copy link

gut4 commented Mar 5, 2023

@domoritz any updates on this?

@PBI-David
Copy link
Contributor

PBI-David commented Mar 6, 2024

For anyone else looking for timer support in VL, it can be achieved as demonstrated in the nice looking clock example on Stack Overflow here: https://stackoverflow.com/questions/78106640/vega-lite-clock-chart/78117784

@domoritz
Copy link
Member Author

domoritz commented Mar 7, 2024

@jonathanzong is working on #8921. All updates are over there.

@apb-reports
Copy link

Check out this example also where I switch between 4 different layers with the use of a timer event. A few warning in the log but it works well. https://stackoverflow.com/questions/78126558/animated-vega-lite-charts

@joelostblom
Copy link
Contributor

Neat, thanks for sharing @apb-reports and @PBI-David; those examples are really neat! Maybe there could be room for a simplified example in the VL gallery? Although when #8921 lands, then the way to achieve something like what you have done might change, so waiting for that first probably makes the most sense (although I'm not familiar with timers myself)

@apb-reports I saw that your latest SO post asks to discuss how to "improve the spec further". Just a headsup that it might get closed as too unspecific so feel free to share on the VegaLite slack as well for more potential to discuss.

@apb-reports
Copy link

Hi @joelostblom, that would be amazing if you would add my 2 animated clocks and my 2 rotating chart examples as Vega lite examples. I will check out the slack site also. Adam

clocks:
https://stackoverflow.com/questions/78106640/vega-lite-clock-using-a-timer-in-vega-lite

Rotating charts:
https://stackoverflow.com/questions/78126558/animated-vega-lite-charts

These would be work well on a tv dashboard for example.

@domoritz
Copy link
Member Author

@apb-reports please send a pull request to add these.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Animation
Development

No branches or pull requests

9 participants