{ "$schema": "https://vega.github.io/schema/vega-lite/v4.json", "data": { "url": "https://vega.github.io/vega-lite/data/movies.json" }, "description": "A layered histogram and cumulative histogram.", "encoding": { "x": { "axis": { "title": "IMDB rating" }, "field": "bin_IMDB_Rating", "scale": { "zero": false }, "type": "quantitative" }, "x2": { "field": "bin_IMDB_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": "bin_IMDB_Rating", "bin": true, "field": "IMDB_Rating" }, { "aggregate": [ { "as": "count", "op": "count" } ], "groupby": [ "bin_IMDB_Rating", "bin_IMDB_Rating_end" ] }, { "filter": "datum.bin_IMDB_Rating !== null" }, { "frame": [ null, 0 ], "sort": [ { "field": "bin_IMDB_Rating", "order": "ascending" } ], "window": [ { "as": "cumulativeCount", "field": "count", "op": "sum" } ] } ] }