hvega-0.11.0.1: tests/specs/gallery/advanced/layered1.vl
{
"$schema": "https://vega.github.io/schema/vega-lite/v4.json",
"data": {
"url": "https://vega.github.io/vega-lite/data/movies.json"
},
"description": "Layered Histogram and Cumulative Histogram",
"encoding": {
"x": {
"field": "binIMDB_Rating",
"scale": {
"zero": false
},
"title": "IMDB Rating",
"type": "quantitative"
},
"x2": {
"field": "binIMDB_Rating_end"
}
},
"layer": [
{
"encoding": {
"y": {
"field": "cumulativeCount",
"type": "quantitative"
}
},
"mark": "bar"
},
{
"encoding": {
"y": {
"field": "count",
"type": "quantitative"
}
},
"mark": {
"color": "yellow",
"opacity": 0.5,
"type": "bar"
}
}
],
"transform": [
{
"as": "binIMDB_Rating",
"bin": true,
"field": "IMDB_Rating"
},
{
"aggregate": [
{
"as": "count",
"op": "count"
}
],
"groupby": [
"binIMDB_Rating",
"binIMDB_Rating_end"
]
},
{
"filter": "datum.binIMDB_Rating !== null"
},
{
"frame": [
null,
0
],
"sort": [
{
"field": "binIMDB_Rating",
"order": "ascending"
}
],
"window": [
{
"as": "cumulativeCount",
"field": "count",
"op": "sum"
}
]
}
]
}