Vega Editor URL#

URL output creates a link that opens a Vega or Vega-Lite specification in the Vega Editor. Use it to share a chart that others can inspect and edit.

Warning

The specification is compressed and encoded in the URL, not encrypted. Anyone with the link can read the specification, including its inline data. Do not share a link containing private data or credentials.

Generating the URL does not render the chart or upload the specification to the Vega Editor. The editor renders it when someone opens the link. External data and images are not embedded, so their URLs must be accessible from the browser. VlConvert configuration settings are not included in the link.

Create an Editor URL#

Save the specification from Quick Start as chart.vl.json:

chart.vl.json
{
  "$schema": "https://vega.github.io/schema/vega-lite/v6.json",
  "data": {
    "values": [
      {"category": "A", "value": 28},
      {"category": "B", "value": 55},
      {"category": "C", "value": 43},
      {"category": "D", "value": 91},
      {"category": "E", "value": 81}
    ]
  },
  "mark": "bar",
  "encoding": {
    "x": {"field": "category", "type": "nominal"},
    "y": {"field": "value", "type": "quantitative"}
  }
}
from pathlib import Path

import vl_convert as vlc

spec = Path("chart.vl.json").read_text(encoding="utf-8")
url = vlc.vegalite_to_url(spec)
print(url)

Output:

https://vega.github.io/editor/#/url/vega-lite/N4IgJAzgxgFgpgWwIYgFwhgF0wBwqgegIDc4BzJAOjIEtMYBXAI0poHsDp5kTykBaADZ04JAGyUAVhDYA7EABoQAEySYUqUMSSCGcCGgDaoKGvJsATgE80IAIKKQ23XDQAmABwBfBSbNlLG3QAIUdnPTQAVkifP0xza1sAYTCdCNQAFgBmWJBTeIDE9AARVJc0AE4ARlz8hKCQAFEy9I8agF0fEGQLAGtbJiQLRzhZKDZlGlkyNFAAD1mQADMaOEFlWzrCmyVMKxxXdFk2BCmdEC6g0BW1jfRw1139w5AARwYkWUw6NRpSC68XiAA

Click the URL to open it in a new browser tab. By default, the editor shows both the specification and the chart.

Use vega_to_url() for Vega specifications. Set fullscreen=True to open the chart in the editor’s full-screen view.

For a standalone HTML page instead of an editor link, see Interactive HTML Output.