Vega Reference Overview

A Vega specification is a JSON-formatted structure that describes a visualization, which can be sent to the back end for rendering. This document introduces the the Vega specification syntax and provides links to topics that provide more details about each Vega property.

For examples of using Vega, see Tutorials. You can also see and edit examples in Try Vega.

Specification Language Syntax

The Vega specification includes properties for describing the source data, mapping the data to the visualization area, and visual encoding. The root Vega specification supported by OmniSci has the following JSON structure and top-level properties:

{
  "width": <number>,
  "height": <number>,
  "data": [],
  "projections": [],
  "scales": [],
  "marks": []
}

Property

Type

Description

width and height

unsigned integer

Visualization area width and height, in pixels. Both properties are required. Example: Set the viewing area width to 384 pixels and the height to 564 pixels:

array

Source data. The Vega data model uses tabular data, similar to a spreadsheet. Organized in rows with any number of named columns. JSON format:

array

Projection data. Maps longitude and latitude data to projected x and y coordinates. JSON format:

array

Data-to-visualization area mapping. Maps visually encoded data values to pixel positions with attributes, such as color. JSON format:

array

Geometric primitive used to visually encode data. JSON format:

Format Rules

  • Property names are case-sensitive.

  • Property values are typed.

  • Unsupported properties are ignored by the rendering engine.

Last updated