Black Lives Matter. Please consider donating to Black Girls Code today.

[resolved] Getting 3D hover events?

I am trying to capture click/hover events from a 3D surface plot and generate new traces from where the user clicks, a.k.a. “picking”. For example, when the user clicks on a surface, a streamline is drawn through the point and the plot is updated.

html.Div([
    dcc.Graph(id = 'main_graph' ),
    html.Pre(id='hover-data', style=styles['pre']),
 ]

@app.callback(
    Output('hover-data', 'children'),
    [Input('main_graph', 'hoverData')])
def display_rover_data(hoverData):
    return json.dumps(hoverData, indent=2)

But this doesn’t actually render the hover data as it would in the 2D example.

Thanks for reporting @asherp! It doesn’t look like this is supported right now. I’ve added the feature request here https://github.com/plotly/plotly.js/issues/2132, feel free to watch that issue or :+1: it

Hi,

Turns out I forgot to import json and didn’t notice the traceback… Also, I’d just like to congratulate you all on putting together such an amazing framework. I build visualization tools for space weather scientists at NASA, and this could really change the way we do things around here.

Thanks for the prompt reply!

1 Like