How to render a vega spec?

You can get vega specs (json/objects) and render them but I don’t see how to do this yet in observable vl.


spec =… .toObject()

then how to render with vl?

I think it is usually an input into vegaEmbed or from_spec but am not yet finding these functions.

What do you mean, like?

Have you got a notebook example of that you are trying to do?

Sure “from_spec” but I mean where is it? vl.from_spec does not exist. Neither does vl.vega.from_spec no vl.vegalite.from_spec and I do not understand how this vl thing is plugged into observable notebooks. That is the real problem else I could just grep/read stuff.

The problem is this is how vega docs look:

It’s all json.

Yet observable has some assembly thing with js. So we need to know how things map. Another example is config (above). Not sure where that goes in the vl assembly yet.

Yes, the link that Brett shared is from a different (and obsolete) implementation.

You can use vega-embed to render a Vega spec:

1 Like