vega-lite
vega-lite copied to clipboard
Boolean field selection issue when selection is bound to legend
When binding a selection for a boolean field to the legend, I can select "true" as expected, but for "false", I have to click between the symbol and the word. Clicking on the symbol (circle in the example below) or the string "false" produces the following error in the log: [Error] Cannot read properties of undefined (reading '0')
{
"config": {"view": {"continuousWidth": 400, "continuousHeight": 300}},
"data": {
"url": "https://cdn.jsdelivr.net/npm/[email protected]/data/barley.json"
},
"mark": "point",
"encoding": {
"color": {"field": "variety", "type": "nominal"},
"opacity": {
"condition": {"value": 1, "selection": "selector022"},
"value": 0.2
},
"shape": {"field": "b", "type": "nominal"},
"x": {"field": "year", "type": "ordinal"},
"y": {"field": "yield", "type": "quantitative"}
},
"selection": {
"selector022": {"type": "multi", "fields": ["b"], "bind": "legend"}
},
"transform": [{"calculate": "datum.variety=='Glabron'", "as": "b"}],
"$schema": "https://vega.github.io/schema/vega-lite/v5.2.0.json"
}