Vega Lite - Filter out bar chart values by interacting with legend

Viewed 60

I’m currently building a Vega-Lite chart and one requirement is that it needs to be interactive with the legend as you can see in the images below:

Vega lite bar chart | Vega lite bar chart filtered

The idea is that when I click on a legend item, the values matching in every bar should be filtered out (disappear) instead of being highlighted. I think it should be pretty straightforward but I doubt if it's possible.

Here's the prototype I'm currently building in Vega-Lite Editor

I'm currently using params for creating a binding with the legend and then transform > filter, but the result is that when I click, all the legend items are filtered out except the selected one.

Any idea or suggestion is more than welcome!

0 Answers
Related