hoverData shown as NoneType

Hi all! I’m a total newbie to Dash.
I’m trying to create an interactive graph while hovering on the other, but whenever I run, hoverData is shown as NoneType,

e,g

date=hoverData[“points”][0][“x”]

TypeError: ‘NoneType’ object has no attribute ‘getitem

but the following works just fine

@app.callback(
Output('output', 'children'),
[Input('cancel_rate_graph', 'hoverData')])

def display_hoverdata(hoverData):
return [
    json.dumps(hoverData, indent=2)
  
]

Any lead/suggestion would help! Thank you!

Hi there,
I just ran into this and came across your topic. I *think it’s because sometimes Dash finds blank hoverData without a “points” key? So you could do something like:

    if hoverData:
        date = hoverData[“points”][0][“x”]
    else:
       date = None

This worked for me.

Cheers,
Lonny