Hi @jmillz welcome to the forum! I would not know how to change the HOVERMINTIME in the javascript, but here are a couple of thoughts more related to Dash.
- hovering over a scattergl trace with 100k points should not be lagging. I just made a toy app and checked that the hover updates very quickly
import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output, State
import plotly.graph_objects as go
app = dash.Dash(__name__)
import json
import numpy as np
N = 100000
fig = go.Figure(go.Scattergl(x=np.random.random(N), y=np.random.random(N),
mode='markers'))
app.layout = html.Div(
[
dcc.Graph(id='graph', figure=fig),
html.Div(id='text')
]
)
@app.callback(
Output('text', 'children'),
[Input('graph', 'hoverData')],
)
def display_data(data):
if not data:
return dash.no_update
return json.dumps(data)
if __name__ == '__main__':
app.run_server(debug=True)
However, it is possible that hoverData
triggers a callback which takes some time to execute, therefore the app is lagging when the callback is fired many times. Maybe one thing you can do is to impose a minimal time between consecutive executions of the callback, as
import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output, State
import plotly.graph_objects as go
app = dash.Dash(__name__)
import json
import time
import numpy as np
N = 100000
fig = go.Figure(go.Scattergl(x=np.random.random(N), y=np.random.random(N),
mode='markers'))
app.layout = html.Div(
[
dcc.Graph(id='graph', figure=fig),
html.Div(id='text'),
dcc.Store(id='store', data=time.time())
]
)
@app.callback(
[Output('text', 'children'),
Output('store', 'data')],
[Input('graph', 'hoverData')],
[State('store', 'data')]
)
def display_data(data, t):
if not data or not t or time.time() < t + 2:
print(data, t, time.time())
return dash.no_update, dash.no_update
time.sleep(2)
return json.dumps(data), time.time()
if __name__ == '__main__':
app.run_server(debug=True)
I know this is not exactly what you’re looking for, but maybe it can still help you. If you disagree about the origin of the lag (I think it’s a callback, not the hover itself), please post more code, ideally a standalone app with dummy data so that we can test.