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