import plotly.graph_objects as go


def load_data():
    return [
        (1978, 18),
        (1979, 19),
        (1980, 20),
        (1981, 22),
        (1982, 24),
        (1983, 26),
        (1984, 27),
        (1985, 27.5),
    ]


def value_table(data):
    return {
        "columns": ["Deadline", "Standard (miles per gallon)"],
        "rows": [list(row) for row in data],
    }


def make_before(data) -> go.Figure:
    x, y = zip(*data, strict=True)
    fig = go.Figure(
        go.Scatter(x=x, y=y, mode="lines+markers", name="Fuel economy", showlegend=True)
    )
    fig.update_layout(template="simple_white", yaxis_title="Miles per gallon")
    return fig


if __name__ == "__main__":
    print(make_before(load_data()).to_json())
