# New Feature Preview! Floating tooltips with \`hoveranywhere\`

**URL:** <https://community.plotly.com/t/new-feature-preview-floating-tooltips-with-hoveranywhere/97554>\
**Category:** Dash Python\
**Created:** [September 3, 2026, 4:20pm UTC](https://community.plotly.com/t/new-feature-preview-floating-tooltips-with-hoveranywhere/97554 "2026-09-03T16:20:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![AnnMarieW](https://avatars.discourse-cdn.com/v4/letter/a/ec9cab/32.png) [@AnnMarieW](https://community.plotly.com/u/AnnMarieW)\
**Post date:** [September 3, 2026, 4:20pm UTC](https://community.plotly.com/t/new-feature-preview-floating-tooltips-with-hoveranywhere/97554/1 "2026-09-03T16:20:34Z")

</div>

# Coming soon! 🎉

**New in Dash 4.5 and Plotly 7**

When you add `hoveranywhere=True` or `clickanywhere=True` to Plotly figures, you can now get the get the cursor position even when it isn’t directly over a data point. The resulting `hoverData` or `clickData` includes both the data coordinates (`xvals`, `yvals`) and the pixel coordinates (`xPixel`, `yPixel`).

This makes it possible to use `dcc.Tooltip` to create tooltips that follow the cursor rather than being anchored to a data point.

The example below uses `hoveranywhere=True` to show the price at the cursor position and calculate how many trading days had a higher price.

![hoveranywhere2](https://us1.discourse-cdn.com/flex024/uploads/plot/original/3X/6/e/6ebef8f015dc6173451ae51fb9edef7585cb14a5.gif)

```python
# requires dash>=4.5 and plotly>=7

from dash import Dash, dcc, html, Input, Output
import numpy as np
import pandas as pd
import plotly.express as px

app = Dash()

np.random.seed(42)
dates = pd.date_range("2024-01-01", periods=500, freq="B")

price_changes = np.random.normal(0, 1.5, len(dates))
prices = 100 + np.cumsum(price_changes)

df = pd.DataFrame({
    "date": dates,
    "price": prices,
})

fig = px.line(
    df,
    x="date",
    y="price",
    labels={"date": "Date", "price": "Price"},
)

fig.update_layout(
    hoveranywhere=True,
    title="Stock Price at Cursor",
    xaxis=dict(showspikes=False),
    yaxis=dict(
        showspikes=True,
        spikemode="toaxis+across",
        spikesnap="cursor",
        spikecolor="#FF4136",
        spikethickness=1.5,
    ),
)

app.layout = html.Div([
    dcc.Graph(
        id="ha-stock-chart",
        figure=fig,
        clear_on_unhover=True,
        config={"displayModeBar": False},
    ),
    dcc.Tooltip(
        id="ha-tooltip",
        direction="top",
        children=html.Div([
            html.Div(id="ha-tooltip-line1", style={"fontWeight": "bold"}),
            html.Div(id="ha-tooltip-line2"),
        ]),
    ),
])

@app.callback(
    Output("ha-tooltip", "show"),
    Output("ha-tooltip", "bbox"),
    Output("ha-tooltip-line1", "children"),
    Output("ha-tooltip-line2", "children"),
    Input("ha-stock-chart", "hoverData"),
)
def update_tooltip(hover_data):
    if not hover_data:
        return False, {}, None, None

    if not hover_data.get("xPixel"):
        return False, {}, None, None

    price = hover_data["yvals"][0]
    count = (df["price"] > price).sum()

    bbox = {
        "x0": hover_data["xPixel"] - 5,
        "x1": hover_data["xPixel"] + 5,
        "y0": hover_data["yPixel"] - 5,
        "y1": hover_data["yPixel"] + 5,
    }

    return (
        True,
        bbox,
        f"Price at cursor: ${price:.2f}",
        f"Trading days above this level: {count}",
    )

if __name__ == " __main__":
    app.run(debug=True)

```

---

<div class="post-metadata">

**Author:** ![AnnMarieW](https://avatars.discourse-cdn.com/v4/letter/a/ec9cab/32.png) [@AnnMarieW](https://community.plotly.com/u/AnnMarieW)\
**Post date:** [September 3, 2026, 4:23pm UTC](https://community.plotly.com/t/new-feature-preview-floating-tooltips-with-hoveranywhere/97554/2 "2026-09-03T16:23:24Z")

</div>

See more use-cases for hoveranywhere and clickanywhere here:

> [@megaphone New Feature: Click & Hover Anywhere on Graphs with Plotly 6.7 + Dash 4.4!](https://community.plotly.com/t/new-feature-click-hover-anywhere-on-graphs-with-plotly-6-7-dash-4-4/97220):
>
> megaphone New Feature: Click & Hover Anywhere on Graphs with Plotly 6.7 + Dash 4.4! Hey everyone, We’re excited to announce a new interactive feature for dcc.Graph that’s been a popular request from the Dash community. Starting with Dash 4.4 (using plotly.py 6.7 or plotly.js 3.5.0), graphs can now respond to clicks and hover events anywhere in the plotting area, not just on existing data points. This allows for a wide range of features, including drawing and annotation tools, measuring di…
