{ "$schema": "https://vega.github.io/schema/vega-lite/v4.json", "data": { "url": "https://vega.github.io/vega-lite/data/movies.json" }, "description": "Bar chart with label overlay", "encoding": { "y": { "axis": null, "field": "genre", "sort": [ "Action", "Adventure", "Comedy", "Black Comedy", "Romantic Comedy", "Concert/Performance", "Documentary", "Drama", "Horror", "Musical", "Thriller/Suspense", "Western", "unclassified" ], "type": "nominal" } }, "height": { "step": 16 }, "layer": [ { "encoding": { "x": { "aggregate": "mean", "field": "IMDB_Rating", "scale": { "domain": [ 0, 10 ] }, "title": "Mean IMDB Ratings", "type": "quantitative" } }, "mark": { "color": "#ddd", "type": "bar" } }, { "encoding": { "detail": { "aggregate": "count", "type": "quantitative" }, "text": { "field": "genre", "type": "nominal" } }, "mark": { "align": "center", "dx": 5, "type": "text" } } ], "transform": [ { "as": "genre", "calculate": "isValid(datum.Major_Genre)? datum.Major_Genre : 'unclassified'" } ], "width": 200 }