Expressions can be used with the
All basic arithmetic operators are supported:
(1 + 2) * 3 / 4
The current data object is provided as the
datum object. Its properties (fields)
can be accessed by using the dot or bracket notation:
datum.foo + 2
If the name of the property contains special characters such as "
datum['A very *special* name!'] > 100
datum.foo < 5 ? 'small' : 'large'
And an equivalent
if(datum.foo < 5, 'small', 'large')
Provided constants and functions¶
Common mathematical functions are supported:
(datum.u % 1e-8 > 5e-9 ? 1 : -1) * (sqrt(-log(max(1e-9, datum.u))) - 0.618) * 1.618
The full list of built-in constants and functions are documented in vega-expression.