import plotly.graph_objects as go


def load_data():
    return [(1978, 18), (1985, 27.5)]


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


def make_after(data) -> go.Figure:
    start, end = (row[1] for row in data)
    fig = go.Figure(
        go.Indicator(
            mode="number+delta",
            value=end,
            delta={"reference": start, "valueformat": ".1f", "suffix": " mpg"},
            number={"suffix": " mpg"},
            title={"text": "1985 standard and increase since 1978"},
        )
    )
    fig.update_layout(template="simple_white", height=250)
    fig.update_layout(
        font={"family": "Inter, system-ui, -apple-system, sans-serif", "color": "#1f2937"},
        colorway=["#3b82c4", "#d97706", "#14967f", "#8b5cf6", "#dc4c3e", "#78716c"],
    )
    return fig


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