7

I am trying to develop an interactive chart using Vega-Lite but I am not able to find any documentation that refers to interactive chart, mainly eventlisteners.

So, wanted to know if Vega-Lite has that capability.

Please help me here as I am a newbie and really need to develop an interactive chart preferably using Vega-Lite, if possible; otherwise I will go with Vega.

jakevdp
  • 77,104
  • 11
  • 125
  • 160
JVM
  • 946
  • 1
  • 10
  • 23
  • Have you read [this](https://github.com/vega/vega-lite) yet? – Robert Harvey Feb 09 '16 at 23:54
  • Yes, I did. I checked all the examples also but did not see a single example of interactive chart. – JVM Feb 10 '16 at 02:23
  • What you have here is a classic example of the [Facade Pattern](https://en.wikipedia.org/wiki/Facade_pattern), a pattern designed to shield the user from much of the complexity of an API, in part by hiding those elements which the Facade creator deems too complex for ordinary uses. I consider it highly likely that, if EventListeners don't show up in the Vega-Lite documentation, that they're probably not supported. – Robert Harvey Feb 10 '16 at 02:47
  • My understanding is, event handling is pretty basic thing (e.g. hover or click event) considering it as a graphing and charting api. They have provided a compiler also that compiles the vega-lite specification to vega specification. I am not getting the purpose of creating vega-lite if such basic features have been suppressed. I did see that vega-lite uses intelligent defaults of lot of properties of Vega so why not handling events as well? – JVM Feb 10 '16 at 20:24
  • "Intelligent defaults" is probably not something you have to hook up, like an event. – Robert Harvey Feb 10 '16 at 21:12
  • Interactivity is not a necessity and is way overused IMO. The Vega-Lite spec is a great way to serialize, transfer, reuse & share visualizations. It supports dynamic data as well. Look [here](http://stackoverflow.com/questions/35300914/can-we-add-event-listeners-to-vega-lite-specification) for references as to how to possibly tack-on interactivity. Full Vega lets you encode interactivity right into the spec. – hrbrmstr Feb 28 '16 at 13:11

3 Answers3

9

No. Vega supports everything that vega-lite does, as vega-lite is compiled into vega code. However, vega-lite does not support everything that vega does.

However, if you want to use vega-lite, but want to take advantage of a feature available only in vega (like interactivity), you can start with vega-lite code, convert it into vega code (the online vega editor allows this) and then continue editing the vega code.

user2461797
  • 251
  • 3
  • 5
5

Specifying interactivity in Vega-Lite will be possible as of some time in mid-2017. Here is the announcement, including a paper and a demo video: Vega-Lite: A Grammar of Interactive Graphics

jakevdp
  • 77,104
  • 11
  • 125
  • 160
2

As the accepted answer said: No. Let me provide examples:

  • SVG graphics support: You can't choose how to render your chart (image, svg) in Vega Lite.
  • Week timeunit support: You can set timeunit to "week" only in Vega, this missing property is particularly frustrating.
  • Select drop-down lists: Adding drop down lists that update chart upon selection are available only in Vega.
  • Some Donut chart styling properties: Vega privdes more options to customize the look of the Donut chart.
Cortex
  • 585
  • 3
  • 19