Value

Edit this page
// Specification of a Single View
{
  ...,
  "encoding": {     // Encoding
    ...: {
      "value": ..., // Value
    },
    ...
  },
  ...
}

A value definition must include a value property to map a constant value to an encoding channel.

Property Type Description
value Number | String | Boolean

Required. A constant value in visual domain (e.g., "red" / “#0099ff” for color, values between 0 to 1 for opacity).

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.