{ "$schema": "https://vega.github.io/schema/vega-lite/v4.json", "data": { "format": { "parse": { "Release_Date": "date:'%b %d %Y'" } }, "url": "https://vega.github.io/vega-lite/data/movies.json" }, "encoding": { "x": { "field": "Release_Date", "type": "temporal" }, "y": { "axis": { "title": "Residual" }, "field": "RatingDelta", "type": "quantitative" } }, "mark": { "opacity": 0.3, "strokeWidth": 0.3, "type": "point" }, "transform": [ { "filter": "datum.IMDB_Rating != null" }, { "filter": { "field": "Release_Date", "range": [ null, { "year": 2019 } ] } }, { "frame": [ null, null ], "window": [ { "as": "AverageRating", "field": "IMDB_Rating", "op": "mean" } ] }, { "as": "RatingDelta", "calculate": "datum.IMDB_Rating - datum.AverageRating" } ] }