Filter Top-k items in vega-lite api

Hello everyone, I’m new to vega-lite and observable. I’m trying to filter the top-k items in column to display in the graph, but I’m having a hard time.
How can I do what is described here using the api? I also would like to show the k biggest and k smallest values, is it possible?

Hi, you might find this tutorial helpful:

2 Likes