question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add timer-based signals to Vega

See original GitHub issue

One of the constant asks I hear is how to do animations in Vega. Animations require timer-based event mechanism, so one solution is to add a signal that changes on timer. This issue is to discuss the best interface/approach. It doesn’t have to be implemented in core vega, but would be good to get everyone’s opinions.

Simple - name-based

This, somewhat hacky approach, allow addition of timers with the minimal Vega code changes. A Vega plugin could iterate over all signals, and if any signal names match /^timer_([0-9]+)$/, automatically update signal’s value with the new Date() object every (number) milliseconds. The timer can be paused/resumed by setting its value to truthy/falsy value.

signals: [{
  "name": "timer_1000",  // will be updated once a second
  "value": true
}]

Complex - core support

Extend core event parsing mechanism to allow parameter passing. This approach might be more flexible in some cases, but also makes it harder to suspect/resume timer as needed.

signals: [{
  "name": "myTimerSignal",
  "on": [{"events": "timer(1000)", "update": "..."}]
}]

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:15 (10 by maintainers)

github_iconTop GitHub Comments

5reactions
domoritzcommented, May 9, 2018

I believe we could use this to implement games in Vega 😃

2reactions
nyurikcommented, May 11, 2018

@domoritz good idea, but i think this shouldn’t be a core feature yet - maybe a plugin? Several reasons:

  • WS hasn’t been standardized as a data transmission format - each site implements its own custom protocol
  • I wouldn’t want Vega update to all of a sudden support a new protocol by default for security reasons. The less functionality is enabled by default, the more secure the product is. (only enable what you need - smaller attack surface).

As for Hans Rosling viz - agree, I think I misunderstood @g3o2 to mean streaming data support, not (looped) time animation.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Building a dynamic countdown in Power BI with Deneb & Vega
Because our logic is evaluated based on timer events, ... In our specification, we'll add a signals property (which is an array), ...
Read more >
Sony Vegas Tutorial | Add a TIMER to your video ... - YouTube
If you'd like me to post twice a week like I did today, "Like" the video and show your support! I'd really appreciate...
Read more >
Signals | Vega
Signals are dynamic variables that parameterize a visualization and can drive interactive behaviors. Signals can be used throughout a Vega specification, for ...
Read more >
Timer Controlled HD recorder - VEGAS Community
This involves feeding the signal from a camera to two recording devices with ... Does anyone know of a portable recorder that can...
Read more >
Animated Vega-Lite: Unifying Animation with a Grammar of ...
We present Animated Vega-Lite, a set of extensions to Vega-Lite that model ... the timer signals would simply emit the next year value...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found