Skip to content
Advertisement

Can’t figure out why graph is not updating

I’m setting up a plotly-dash website where I want to show data from some domains from different points in time. Therefore I have a slider with which you can decide which data from which point in time you want to see. That already works. Moreover I want that if somebody clicks on one point it shows a line between all positions of this domain from every point in time.

I have tried to define an update function, so that I update the data for the trace with the line in it. However the graph itself does not look different after the update.

JavaScript

I just want the graph to be updated as well, not just the underlying data.

Advertisement

Answer

Have a look at Dash callbacks here:

https://dash.plot.ly/getting-started-part-2

In short, you need to add decorators to your callbacks which says which input triggers the callback and which graph needs to be updated on a callback run. You cannot trigger a callback programmatically and expect it to change the graph. The callback needs to come from the UI, as far as I know.

Eg:

JavaScript

This example expects the callback to be triggered when the input with id “my-id” has a change in value, and in return, it changes the value of the div. The “Output” in the decorator needs to be your graph if you need a callback to change a graph.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement