vega-lite-api
vega-lite-api copied to clipboard
Confused by the predicate in `vl.color().condition()`
The docs for vl.color().condition()
say:
A field definition or one or more value definition(s) with a parameter predicate.
I'm trying to replicate the point_invalid_color using Vega Lite API and based on the language in the doc I would have thought I would do:
vl.color().condition(
'datum[\'IMDB Rating\'] === null || datum[\'Rotten Tomatoes Rating\'] === null',
'#aaa'
)
That compiles to:
"color": {
"condition": [
"datum['IMDB Rating'] === null || datum['Rotten Tomatoes Rating'] === null"
"#aaa"
]
}
I have to do this instead:
vl.color().condition({
test: 'datum[\'IMDB Rating\'] === null || datum[\'Rotten Tomatoes Rating\'] === null',
value: '#aaa'
})
Is this the desired API? If so, I would expect the docs to describe an object with keys of test
and value
.