I have a Dash UI to gather user input. When the user submits the form data (I have a Submit button), the values get sent to a Flask server (backend) via REST api, which in turn sends back an array of values. I display these values on the UI as a graph (dcc.Graph). The Submit button callback prepares a graph object and returns it to be displayed in a graph placeholder.
If I want to resubmit the form (with different input values), I’d like to clear the graph, and then redraw it based on the values returned by the backend. I’m unable to do this in the same callback function (can’t return two graph objects from the same callback). It seems I can’t have two callback functions with the same output either, so I can’t even put a CLEAR button on the UI.
Could you please suggest a way of clearing the graph before redrawing it?