Vega-Lite View Specification: Documentation Overview
Vega-Lite View Specification: Documentation Overview
Documentation Overview
Common Properties of Specifications
Top-Level Specifications
Single View Specifications
Layered and Multi-view Specifications
View Configuration
o Default View Size
o View Styles
Top-Level Specifications
In addition to the common properties, any kind of top-level specifications (including a
standalone single view specification as well as layered and multi-view specifications)
can contain the following properties:
Property Type Description
URL to JSON schema for a Vega-Lite specification.
Unless you have a reason to change this, use
https://vega.github.io/schema/vega-lite/v2.json .
$schema String
Setting the $schema property allows automatic
validation and autocomplete in editors that support
JSON schema.
CSS color property to use as the background of
visualization.
background String
Default value: none (transparent)
The default visualization padding, in pixels, from the
edge of the visualization canvas to the data
rectangle. If a number, specifies padding for all sides.
If an object, the value should have the format
padding Number | Object
{"left": 5, "top": 5, "right": 5, "bottom": 5} to
specify padding for each side of the visualization.
Default value: 5
Sets how the visualization size should be determined.
If a string, should be one of "pad" , "fit" or "none" .
Object values can additionally specify parameters for
String | content sizing and automatic resizing. "fit" is only
autosize
AutoSizeParams supported for single and layered views that don’t use
rangeStep .
A single view specification describes a graphical mark type (e.g., point s or bar s) and
its encoding , or the mapping between data values and properties of the mark. By
simply providing the mark type and the encoding mapping, Vega-Lite automatically
produces other visualization components including axes, legends, and scales.
Unless explicitly specified, Vega-Lite determines properties of these components
based on a set of carefully designed rules. This approach allows Vega-Lite
specifications to be succinct and expressive, but also enables customization.
Note: For plots with row and column channels, this represents
the width of a single view.
Property Type Description
See also: The documentation for width and height contains
more examples.
The height of a visualization.
Default value:
Note: For plots with row and column channels, this represents
the height of a single view.
layer
facet
concat
repeat
View Configuration
// Top-level View Specification
{
...,
"config": { // Configuration Object
"view": { ... }, // - View Configuration
...
}
}
The style of a single view visualization can be customized by specifying the view
property of the config object.
For more information about view size, please see the size documentation.
View Styles
Property Type Description
clip Boolean Whether the view should be clipped.
The fill color.
fill String
Default value: (none)
The fill opacity (value between [0,1]).
fillOpacity Number
Default value: (none)
The stroke color.
stroke String
Default value: (none)
The stroke opacity (value between [0,1]).
strokeOpacity Number
Default value: (none)
Property Type Description
The stroke width, in pixels.
strokeWidth Number
Default value: (none)
An array of alternating stroke, space lengths for creating
dashed or dotted lines.
strokeDash Number[]
Default value: (none)
The offset (in pixels) into which to begin drawing with
the stroke dash array.
strokeDashOffset Number
Default value: (none)