Detect when graph has ended loading

I have some graphs that takes around 30 seconds to load for the first time. I load them on the first load on the callbacks when the condition not ctx.triggered is met. The thing is that after this intentional callback for loading the graph, the graph still takes some time to load.

What I want to do is to know when the graphs have ended loading in order to tell the frontend via websockets that this event has happened. I have also tried to approach it reading the petitions of the middleware but there were no callbacks that I could detect that indicated that the graphs have been fully loaded.

Therefore, my question is: how can I detect when a graph has fully been loaded?

1 Like

PS: I know that the loading template can be personalized, but I want to integrate it with other parts loaded asynchronously which will share a loading screen, that’s why the customized loading option of Dash would not solve this problem.

Haven’t used this myself before, but you might be looking for the loading_state object? It’s one of the properties of the Graph component: Graph | Dash for Python Documentation | Plotly

Hi, @yanboe. I’ve tried to implement that solution following this example but the thing is that the callback never gets executed, nor when I point to the div that I want to load, neither when I point to the loading component. Any guesses?

1 Like

Hi,

are there by chance any other guesses of how could I solve this issue?

Can you provide the code so we can have a look at it?