Value

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

You can use a datum definition to map a constant data value to an encoding channel via an underlying scale by setting the datum property.

Examples

Highlight a Specific Data Value

datum is particularly useful for annotating a certain data value.

For example, you can use it with a rule mark to highlight a certain threshold value (e.g., 200 dollars stock price).

You can also use datum with a date time definition, for example, to highlight a certain year:

Using Datum to Color Multi-series Chart

Another application of datum is to color a multi-series line chart created with repeat.