{ "transform": [ { "window": [ { "op": "rank", "as": "rank" } ], "sort": [ { "field": "score", "order": "descending" } ] }, { "filter": "datum.rank <=5" } ], "mark": "bar", "data": { "values": [ { "score": 100, "student": "A" }, { "score": 56, "student": "B" }, { "score": 88, "student": "C" }, { "score": 65, "student": "D" }, { "score": 45, "student": "E" }, { "score": 23, "student": "F" }, { "score": 66, "student": "G" }, { "score": 67, "student": "H" }, { "score": 13, "student": "I" }, { "score": 12, "student": "J" }, { "score": 50, "student": "K" }, { "score": 78, "student": "L" }, { "score": 66, "student": "M" }, { "score": 30, "student": "N" }, { "score": 97, "student": "O" }, { "score": 75, "student": "P" }, { "score": 24, "student": "Q" }, { "score": 42, "student": "R" }, { "score": 76, "student": "S" }, { "score": 78, "student": "T" }, { "score": 21, "student": "U" }, { "score": 46, "student": "V" } ] }, "$schema": "https://vega.github.io/schema/vega-lite/v4.json", "encoding": { "x": { "field": "score", "type": "quantitative" }, "y": { "field": "student", "sort": { "encoding": "x", "order": "descending" }, "type": "nominal" } }, "description": "Filtering the top-k items" }