This website is for Vega-Lite v3. Go to the main Vega-Lite homepage for the latest release.

Value

Edit this page
// A Single View or a Layer Specification
{
  ...,
  "mark/layer": ...,
  "encoding": {     // Encoding
    ...: {
      "value": ..., // Value
    },
    ...
  },
  ...
}

You can use a value definition to map a constant value to an encoding channel by setting the value property.

For example, you can set color and shape of a scatter plot to constant values.

Similarly, value for size channel of bar marks will adjust the bar’s size. By default, there will be 1 pixel offset between bars. The following example sets the size to 10 to add more offset between bars.

Note: Mapping an encoding channel to a constant value is equivalent to setting a property of the "mark" definition block. For example, you can also set color and shape of marks by setting "mark" to {"color": "#ff9900", "shape": "square"}. However, unlike mark definition properties, value definition of an encoding channel can also be combined with condition to specify conditional encoding. See the condition page for more details.