Open-source project
vega/vega-lite avatar
vega/vega-lite

Vega-Lite: A JSON Grammar for Charts, and What It Costs You

A concise grammar of interactive graphics, built on Vega.

5,497 stars722 forksTypeScriptBSD-3-Clause

At a glance

What is it?
Vega-Lite compiles a short declarative JSON spec into a full Vega visualization. It is the right tool when a chart definition needs to travel as data, and the wrong one when you need pixel-level control.
Who is it for?
Adopt Vega-Lite when the chart definition itself must be a portable, serializable artifact: a spec stored in a database, generated by a service, or edited by a tool. Do not adopt it when you need direct control over SVG structure or a bespoke interaction model, because the compiler sits between you and the output.
Can I use it commercially?
Yes. BSD-3-Clause is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository last received commits 1 day ago.
What is it written in?
Mainly TypeScript, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on September 29, 2026, and from our analysis. They are not legal advice.

Editorial analysis

The problem Vega-Lite solves: charts as data, not code

Most charting libraries ask you to write imperative code: create a chart object, bind data, set scales, attach axes, render. Vega-Lite inverts that. The README describes it as "a higher-level grammar for visual analysis that generates complete Vega specifications." You write a JSON object that says what the chart means (mark type, encodings, transforms) and the compiler emits the lower-level Vega spec that actually draws it.

The consequence is that a chart becomes a serializable value. It can be stored in a database column, sent over an API, diffed in version control, or produced by a program that has no JavaScript runtime. That is the specific gap this project fills. Libraries like Chart.js or ECharts assume a JavaScript execution context and a mutable chart instance; Vega-Lite assumes only that something can produce and consume JSON.

The audience follows from that. It is for engineers building dashboards where chart definitions are generated or stored, for tool authors who need a charting backend they do not have to write, and for analysts who want to describe a visualization without learning a rendering API. It is not aimed at someone who wants to hand-tune a single hero chart for a marketing page.

How the compiler turns a spec into a Vega runtime

The repository is a TypeScript project. The package.json declares "type": "module" and exports a single entry point at ./build/index.js with types at ./build/index.d.ts. There is also a second export, ./types_unstable/*, which the package maps to build/*. The naming is a signal: those types are explicitly marked unstable, so anything importing from that path is opting into an interface the maintainers have not committed to keeping stable.

The build pipeline is Rollup. The package.json build script runs rollup -c, and a separate site/rollup.config file exists for the documentation site. The published artifact set includes bin/, build/, src/, and the vega-lite* files, so the npm package ships source alongside compiled output.

The data flow is a two-stage compilation. Vega-Lite spec in, Vega spec out. The Vega runtime then interprets that lower-level spec and renders it. This matters because it means Vega-Lite itself does not draw anything. If you want to know what a Vega-Lite chart will actually look like, the repository keeps examples/compiled/ next to examples/specs/, and the test files examples/examples.test.ts and examples/schema.test.ts sit alongside them. The compiled directory is the ground truth for what a given spec produces.

The package also ships command line binaries: vl2vg, vl2svg, vl2png, and vl2pdf. Those names describe the conversion chain, and they are the fastest way to see the intermediate Vega output without writing any JavaScript.

Installing Vega-Lite and compiling a first spec

The README points to the Vega-Lite website for usage instructions and tutorials rather than embedding install steps, so the authoritative source is https://vega.github.io/vega-lite/usage/embed.html. The npm package is named vega-lite, and the bin field of package.json declares four executables: vl2pdf, vl2png, vl2svg, and vl2vg.

The vl2vg binary converts a Vega-Lite spec into the Vega spec that the runtime consumes. The repository ships the binaries under bin/, so after installing the package they are available on the path:

bash
vl2vg

Running it with a spec file produces the compiled Vega document on standard output. What you should see is a much longer JSON document than the one you wrote. The added material is the scales, axes, legends, and dataflow nodes that Vega-Lite inferred from your encodings. Reading that output is the quickest way to understand what the grammar is doing on your behalf.

The sibling binaries follow the same conversion chain: vl2svg emits SVG, vl2png emits a PNG image, and vl2pdf emits a PDF. The package.json does not document their flags, and the README does not either, so consult the usage page before scripting them.

Where the grammar gets in your way

The compiler is the limitation. Anything Vega-Lite does not model cannot be expressed, and the escape hatch is to write Vega directly, at which point you have left the higher-level grammar behind. If your chart needs a custom mark, an unusual layout, or an interaction that does not map onto the selection model, you will be writing Vega or dropping to D3.

The unstable types export is a second constraint worth weighing. The package.json maps ./types_unstable/* to build/*, which means the stable surface is the root export and the unstable one is everything else. Code that imports from that path can break on a minor release. For a library that other tools build on, that is a deliberate boundary rather than an oversight, but it does constrain how deeply you can integrate.

There is also a runtime dependency you cannot remove. Vega-Lite does not render. You need Vega, and the browser bundles are separate builds (the package points unpkg and jsdelivr at build/vega-lite.min.js). Projects that assume a single self-contained script will need to account for the runtime as a distinct artifact.

Vega-Lite against D3, Plotly and Vega

The comparison that matters most is with Vega, because Vega-Lite compiles into it. Vega is the lower-level specification language; Vega-Lite is the higher-level grammar layered on top. Choosing Vega-Lite means accepting the compiler's opinions about scales, axes and interaction in exchange for writing far less. Choosing Vega means writing the dataflow and scales yourself and getting control the grammar will not give you. They are not competitors so much as two levels of the same stack.

Against D3 the difference is categorical. D3 is a general-purpose library for manipulating documents from data; it has no chart grammar at all. A bar chart in D3 is code you write, with scales and axes assembled by hand. Vega-Lite is the opposite trade: you give up control over how the marks are constructed and gain a declarative description that a machine can generate.

Plotly sits closer to Vega-Lite in spirit, offering a declarative figure description, but its specification is tied to the Plotly rendering stack rather than compiling to a separate intermediate language. The practical distinction is portability: a Vega-Lite spec compiles to Vega, which has its own runtime, whereas adopting Plotly means adopting Plotly's renderer. If the requirement is that the spec outlives the rendering library, that difference decides the choice.

Maintenance, releases and the BSD-3-Clause licence

The repository is not archived, and the last push was on 2026-09-10. That is recent enough that the project is under current development rather than dormant. The release cadence visible in the release list is uneven: v6.4.1 landed on 2025-09-23, v6.4.2 on 2026-01-14, and v6.4.3 on 2026-04-24. Roughly one release per quarter, with the patch version moving rather than the minor. The package.json version is 6.4.3, matching the most recent release.

Upgrade cost is shaped by the unstable types boundary described earlier. If your code imports only from the root export, minor and patch upgrades should be low-risk. If it imports from ./types_unstable/*, budget for breakage on upgrades, because that path is explicitly not a stable contract.

The licence is BSD-3-Clause, declared both in the repository metadata and in the license field of package.json. That is a permissive licence, which generally means you can use, modify and redistribute the code, including in commercial and closed-source products, provided the copyright notice and licence text are retained and you do not use the project's name to endorse derived work. This is a description of what the licence text provides, not legal advice; the LICENSE file in the repository is the controlling document and your legal team should read it.

The README also lists a funding URL in package.json, and the project is led by members and alumni of the University of Washington Interactive Data Lab. Contributions are directed to CONTRIBUTING.md.

Editorial conclusion

Adopt Vega-Lite when the chart definition itself must be a portable, serializable artifact: a spec stored in a database, generated by a service, or edited by a tool. Do not adopt it when you need direct control over SVG structure or a bespoke interaction model, because the compiler sits between you and the output. Before committing, verify that your target renderer consumes Vega-Lite directly, since the npm package exports a compiler and the browser bundles are separate builds.

Frequently asked questions

What is Vega-Lite?

Vega-Lite is a concise grammar of interactive graphics that compiles a high-level JSON specification into a complete Vega specification. It is written in TypeScript and published on npm as vega-lite.

How do you use Vega-Lite?

You write a JSON spec describing marks and encodings, then compile it to Vega, which performs the rendering. The README points to the Vega-Lite website for usage instructions and tutorials, and the package ships vl2vg, vl2svg, vl2png and vl2pdf binaries for converting specs from the command line.

What is the difference between Vega-Lite and Vega?

Vega-Lite is the higher-level grammar; Vega is the lower-level specification language it generates. The README states that Vega-Lite provides a higher-level grammar for visual analysis that generates complete Vega specifications, so a Vega-Lite spec is compiled into a Vega spec before anything is rendered.

Is Vega-Lite open source and free to use?

Yes. The repository is public and the licence is BSD-3-Clause, declared in package.json and in the repository metadata. That is a permissive licence, so the LICENSE file is the document to read for the exact terms.

What is the difference between Vega-Lite and Plotly?

Both let you describe a chart declaratively, but Vega-Lite compiles its spec into Vega, a separate intermediate language with its own runtime, while Plotly's figure description is tied to the Plotly rendering stack. The practical difference is whether the spec is portable across renderers.

Is Vega-Lite free?

The project is published under the BSD-3-Clause licence, which is permissive and does not require payment. The LICENSE file in the repository carries the exact terms.

Official sources

  1. License: BSD-3-Clause
  2. Project website
  3. README
  4. Releases
  5. vega/vega-lite on GitHub
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/vega-vega-lite.svg)](https://hysenlabs.com/projects/vega-vega-lite)