Hi, I have a question about the execution of callbacks.
I have a dash app with a scatter plot and a line plot. When hovering over the markers in the scatter plot, a callback is triggered that updates the line plot. I feel like when I quickly hover over many scatter markers and the callback that updates the line plot is triggered many times, the executions of this callback queue up.
I would like to interrupt the execution of the callback whenever the same callback is triggered again. This means that, when hovering over many scatter markers, only the callback for the scatter marker that was hovered over most recently is executed and all the previous callbacks that might still be running are interrupted. Is this possible?
I hope that I could make clear what I am trying to achieve.
Something like this might work, but I’m not sure if this makes your chart more responsive.
from dash import Dash, DiskcacheManager, dcc, Input, Output, html, callback
import plotly.graph_objects as go
import numpy as np
cache = diskcache.Cache("./cache")
background_callback_manager = DiskcacheManager(cache)
app = Dash(__name__, background_callback_manager=background_callback_manager)
app.layout = html.Div(
y=np.random.randint(0, 1000, 50),
return json.dumps(hoverData, indent=2)
if __name__ == "__main__":