How to compile Vega-Lite project to Vega?

Hello all,

Literally title.
I have a working project in Vega-Lite and want to add "Vega only features" ontop of it.

Is it possible to compile the Vega-Lite script and look at the resulting Vega output?
As far as I'm aware Vega-Lite gets already converted to Vega automatically but I don't know where to look at the resulting code.

So far I haven't found any clue on how to it. But I'm certain this is possible.

Thanks in advance :slight_smile:

If you click the wrench icon in the Kibana vega editor, we offer a "compile to Vega" option.

1 Like

Hi, thanks for the input.
Unfortunately the only options I see are HJSON <> JSON reformat options. (Kibana 7.9).

Is there an alternative to compile the code?

But good to know that this feature exists. I will investigate why the option doesn't show up in my editor and only the 2 reformat options.

Thank you very much :slight_smile:

You're right, that is definitely not present any more. There are two other workarounds I could suggest:

  1. You can type into your browser console VEGA_DEBUG.vega_spec which is the spec that actually gets rendered. There's an equivalent VEGA_DEBUG.vegalite_spec too. Assuming you have an ES query, this will contain the results of your query in array form.
  2. You can convert your spec to JSON and then use the online Vega-Lite editor to convert to Vega.
1 Like

Thank you so much for the clarification on that. I stumbled over this approach - kind of. But now it's very clear on how to proceed.

Thanks again! :slight_smile:

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.