{
    "transform": [
        {
            "filter": "datum.Miles_per_Gallon !== null"
        },
        {
            "as": "year",
            "field": "Year",
            "timeUnit": "year"
        },
        {
            "window": [
                {
                    "op": "mean",
                    "as": "Average_MPG",
                    "field": "Miles_per_Gallon"
                }
            ],
            "sort": [
                {
                    "field": "year",
                    "order": "ascending"
                }
            ],
            "frame": [
                null,
                0
            ],
            "ignorePeers": false
        }
    ],
    "height": 400,
    "data": {
        "url": "https://vega.github.io/vega-lite/data/cars.json"
    },
    "width": 500,
    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
    "layer": [
        {
            "mark": "circle",
            "encoding": {
                "x": {
                    "field": "Year",
                    "timeUnit": "year",
                    "type": "temporal"
                },
                "y": {
                    "field": "Miles_per_Gallon",
                    "type": "quantitative"
                }
            }
        },
        {
            "mark": {
                "color": "red",
                "type": "line"
            },
            "encoding": {
                "x": {
                    "field": "Year",
                    "timeUnit": "year",
                    "type": "temporal"
                },
                "y": {
                    "field": "Average_MPG",
                    "type": "quantitative",
                    "axis": {
                        "title": "Miles per gallon"
                    }
                }
            }
        }
    ]
}