user14887623
user14887623

Reputation: 47

Python Dash hoverData x value

My hoverData returns an object like this:

{
    'points': [{
        'curveNumber': 3,
        'pointNumber': 25,
        'pointIndex': 25,
        'x': '      2017 Feb',
        'y': 0.98
    }]
}

code:

@app.callback(dash.dependencies.Output("div_table1", 'children'),
              [dash.dependencies.Input('graph1', 'hoverData')])
def update_table1(hover_graph1):
   print(hover_graph1)

Is it a list?

How can I get the x value ' 2017 Feb' from it?

Upvotes: 0

Views: 314

Answers (1)

William Baker Morrison
William Baker Morrison

Reputation: 1789

It's a nested dictionary, so you just need to do this:

hover_graph1['points'][0]['x']

Upvotes: 2

Related Questions