Open nukescott opened 3 years ago
update: In my real application (not this trivial one), I have about 20 points on the x axis. When I roll the mouse over the data, if I see hover text, then I can consistently get the callback to fire. If I am 1/2 way between two x points, and there is no hovertext displayed, I never get the callback to fire. Probably there is some proximity setting I am missing or unaware of...
Also, my previous reference to the callback working in dash 1.19.x is probably wrong. Usually I have way more data points on the x axis (like 1000) and then it is impossible to be between points - likely I just never plotted fewer than about 1000 points in 1.19.x so never noticed it.
Finally discovered that if hoverdistance is set to something very large (like 10000) clickdata will consistently fire. This still seems like a bug. I want clickdata to always fire if I click anywhere on a graph, regardless of hoverdistance setting and to fire as if the hovermode is set to closest even if hovermode is actually set to something different. I do not want to have to see the hoverdata to get clickdata to fire. In my real app, I need to have hovermode itself set to 'x'.
If the current behavior is intended, then at least the clickdata documentation (which I can not find anywhere) should indicate that it will not fire if the click is outside the hoverdistance range.
When clicking on a graph, clickdata callbacks seem to fire inconsistently or not at all. Often they will fire on the first mouse click on the graph, but additional clicks, regardless of location on the graph, mostly do not seem to fire. Did not have the problem in dash 1.19.x at all.
I reported a similar, but different issue here: https://github.com/plotly/dash/issues/1300. Adding circular callbacks to the code below does not resolve this issue.
environment: dash 1.20.00 dash-core-components 1.16.0 dash-html-components 1.1.3 dash-renderer 1.9.1 dash-table 4.11.3 displaying with chrome 90.0.4430.85
Code sample below: import dash import dash_core_components as dcc import dash_html_components as html from dash.dependencies import Input, Output
app = dash.Dash(name)
app.layout = html.Div([ dcc.Graph( id='graph', figure={ 'data': [{'x': [0.0,0.0], 'y': [0.001,10], 'type': 'scattergl'}] } ), html.Pre(id='clickDataDisplay') ])
@app.callback( Output('clickDataDisplay', 'children'), [Input('graph', 'clickData')] ) def display_click_data(clickData): print("Processing click data.") print(dash.callback_context.triggered[0])
if name == 'main': app.run_server(debug=True, port=8052)