observablehq / vega

Convenience methods for using Vega and Vega-Lite in Observable.
https://observablehq.com
42 stars 7 forks source link

Expose vega chart object #1

Open tmcw opened 6 years ago

tmcw commented 6 years ago

To do advanced techniques with Vega Lite - like streaming data into it - you need the chart object, which afaik is not exposed through this interface.

domoritz commented 6 years ago

Here are a few demos of how to use streaming data and the reactive features of Vega: https://beta.observablehq.com/@domoritz/reactive-vega-lite and https://beta.observablehq.com/@domoritz/vega-lite-demo-with-streaming-data. All I needed here was access to the Vega view object.

domoritz commented 6 years ago

I'd like to fix this issue. I'm working on an observable module that uses Vega-Embed to render the chart. It will look similar to https://beta.observablehq.com/@domoritz/vega-lite-demo-with-vega-embed. Now I wonder how I can return both the dom object and the view from a module. Any suggestions?

domoritz commented 6 years ago

Here is what I'm currently experimenting with https://beta.observablehq.com/d/d20180516e86a3b3

tmcw commented 6 years ago

Mind publishing that? /d/... URLs are private

domoritz commented 6 years ago

https://beta.observablehq.com/@domoritz/vega-embed-observable-package-experiments and it's using the packages from https://github.com/vega/vega-observable.

Fil commented 6 years ago

All examples are broken on @observablehq, for example https://beta.observablehq.com/@domoritz/reactive-vega-lite results in

Error: unable to load package.json
> embed = require('vega-embed@3')
domoritz commented 6 years ago

@Fil Thanks for the bug report. I fixed it and it should work again once the CDN updates.