# Way to 'cancel' hoverData

**URL:** <https://community.plotly.com/t/way-to-cancel-hoverdata/12017>\
**Category:** Dash Python\
**Created:** [July 23, 2018, 6:37pm UTC](https://community.plotly.com/t/way-to-cancel-hoverdata/12017 "2018-07-23T18:37:00Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![renanxcortes](https://avatars.discourse-cdn.com/v4/letter/r/22d042/32.png) [@renanxcortes](https://community.plotly.com/u/renanxcortes)\
**Post date:** [July 23, 2018, 6:37pm UTC](https://community.plotly.com/t/way-to-cancel-hoverdata/12017/1 "2018-07-23T18:37:00Z")

</div>

Hello!

I’m trying to develop a dashboard that has a map that updates per year. However, I have two ways to update the year in the map: a dcc.Slider input and a time series graph having year as the hovering data.

The problem arises because whenever I hover the graph, the slider input gets non-functional because the years were already updated by the hovering in the time series. Is there a way to ‘erase hoverData’ when the mouse is placed off the graph?

The code chunk that I tried (but unsuccessfully) follows:

@app.callback(  
Output(‘choropleth-graph’, ‘figure’),  
[Input(‘timeseries-graph’,‘hoverData’),  
Input(‘years-slider’,‘value’)])  
def update\_map(year\_hovered, year\_selected\_slider):

```
if year_hovered is None: 
    year = year_selected_slider

else:
    year = year_hovered['points'][0]['x']

```

Best regards,  
Renan

---

<div class="post-metadata">

**Author:** ![chriddyp](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/chriddyp/32/16855_2.png) [@chriddyp](https://community.plotly.com/u/chriddyp)\
**Post date:** [July 23, 2018, 9:03pm UTC](https://community.plotly.com/t/way-to-cancel-hoverdata/12017/2 "2018-07-23T21:03:55Z")

</div>

You can try the `clear_data_on_unhover` property. This will set the data to `None` on unhover.

Note that if you are using hoverData to update the graph itself, this doesn’t work super well (when the graph redraws, it will clear its hover data, causing the callback to be fired, causing the graph to redraw, and so on in a loop)

---

<div class="post-metadata">

**Author:** ![renanxcortes](https://avatars.discourse-cdn.com/v4/letter/r/22d042/32.png) [@renanxcortes](https://community.plotly.com/u/renanxcortes)\
**Post date:** [July 23, 2018, 9:21pm UTC](https://community.plotly.com/t/way-to-cancel-hoverdata/12017/3 "2018-07-23T21:21:25Z")

</div>

Thank you very much! Actually, the property name was ‘clear\_on\_unhover’ and then I set to ‘True’ and I worked just as I expected!

Is there a tutorial that I can read more about this? I didn’t a link to all the properties available for each components.

Kind regards,  
Renan Xavier Cortes

---

<div class="post-metadata">

**Author:** ![chriddyp](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/chriddyp/32/16855_2.png) [@chriddyp](https://community.plotly.com/u/chriddyp)\
**Post date:** [July 23, 2018, 9:38pm UTC](https://community.plotly.com/t/way-to-cancel-hoverdata/12017/4 "2018-07-23T21:38:37Z")

</div>

> [@renanxcortes](#):
>
> Is there a tutorial that I can read more about this? I didn’t a link to all the properties available for each components.

There isn’t right now. Ideally this would be covered in this chapter: [Part 3. Interactive Graphing and Crossfiltering | Dash for Python Documentation | Plotly](https://dash.plot.ly/interactive-graphing) and ideally there would be a section on the `dcc.Graph` in [Dash Core Components | Dash for Python Documentation | Plotly](https://dash.plot.ly/dash-core-components/) but I haven’t written that yet.

For now, you can always figure out which properties are available by calling help on them:

```auto
>>> import dash_core_components as dcc
>>> help(dcc.Graph)

```

---

<div class="post-metadata">

**Author:** ![renanxcortes](https://avatars.discourse-cdn.com/v4/letter/r/22d042/32.png) [@renanxcortes](https://community.plotly.com/u/renanxcortes)\
**Post date:** [July 23, 2018, 9:41pm UTC](https://community.plotly.com/t/way-to-cancel-hoverdata/12017/5 "2018-07-23T21:41:01Z")

</div>

> [@renanxcortes](#):
>
> nput gets non-functional because the years were already updated by the hovering in the time series. Is there a way to ‘erase hoverData’ when the mouse is placed off the graph?

Right! Thank you, Chris!

---

<div class="post-metadata">

**Author:** ![renanxcortes](https://avatars.discourse-cdn.com/v4/letter/r/22d042/32.png) [@renanxcortes](https://community.plotly.com/u/renanxcortes)\
**Post date:** [July 25, 2018, 9:32pm UTC](https://community.plotly.com/t/way-to-cancel-hoverdata/12017/6 "2018-07-25T21:32:45Z")

</div>

Chris, I’m having the same problem but now with clickData. I’ve seen that there’s no similar argument, for example, ‘clear\_on\_unclick = True’. How can I manage this situation?

Best,  
Renan

---

<div class="post-metadata">

**Author:** ![chriddyp](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/chriddyp/32/16855_2.png) [@chriddyp](https://community.plotly.com/u/chriddyp)\
**Post date:** [July 25, 2018, 10:22pm UTC](https://community.plotly.com/t/way-to-cancel-hoverdata/12017/7 "2018-07-25T22:22:10Z")

</div>

I don’t think this is possible right now. We’re working on more generic click handling in this issue [https://github.com/plotly/plotly.js/issues/1852](https://github.com/plotly/plotly.js/issues/1852) and in particular this pull request: [https://github.com/plotly/plotly.js/pull/2824](https://github.com/plotly/plotly.js/pull/2824). It’s a big effort but we’re getting close!
