ExtendData with Go figure gauge not updating value

Hi I have been trying to update the value of dcc Graph with contains a go figure indicator using the extend property. However, I am not able to make value of the figure update on the callback.

The code for displaying the gauge is the following:

def display_gauge():
    fig = go.Figure(
        go.Indicator(
            value=2,
            mode="gauge+number",
            domain={"x": [0, 1], "y": [0, 1]},
            title={"text": "SoC"},
            number={"suffix": "%"},
        )
    )
    col = html.Div([dcc.Graph(figure=fig, id="ct1")])
    return col

The callback is defined the following way. I have tried only returning the value dict as shown below which

@app.callback(
    [
        Output("h6-connector-status", "children"),
        Output("ct1", "extendData"),
    ],
    [
        Input("button-start-charging", "n_clicks"),
        Input("interval-component", "n_intervals"),
        Input("ct1", "figure"),
    ],
    prevent_initial_call=True,
)
def update_metrics(
    start_charging_clicks,
    interval,
    ct1
):
     if ct1:
        ct1["data"][0]["value"] = 12
        print("\n ct1 val: ", ct1["data"][0]["value"])
        
        return (
            "connected",
            (dict(value=[12]), [0]),
        )
    raise PreventUpdate()

I have also tried returning the entire trace of the figure which look the following:

if ct1:
        ct1["data"][0]["value"] = 12
        print("\n ct1 val: ", ct1["data"][0]["value"])
        return (
                  "connected",
                  (ct1, [0]),
              )

However, I have not been able to update the value of the figure. Any help would be greatly appreciated.

hi @nik_2023
:wave: Welcome to the community.

Can you please share a minimal reproducible example – complete sample code that we can plug into our computer and run to reproduce the error you’re getting.