Bar Chart with Label Overlays
View this example in the online editor
Vega-Lite JSON Specification
{
"$schema": "https://vega.github.io/schema/vega-lite/v4.json",
"width": 200,
"height": {"step": 16},
"data": {"url": "data/movies.json"},
"encoding": {
"y": {
"field": "Major Genre",
"type": "nominal",
"axis": null
}
},
"layer": [{
"mark": {"type": "bar", "color": "#ddd"},
"encoding": {
"x": {
"aggregate": "mean",
"field": "IMDB Rating",
"scale": {"domain": [0, 10]},
"title": "Mean IMDB Ratings"
}
}
}, {
"mark": {"type": "text", "align": "left", "x": 5},
"encoding": {
"text": {"field": "Major Genre"},
"detail": {"aggregate": "count"}
}
}]
}