Skip to content

[FEATURE]: Freeze hovertext on click #7663

Open

Description

@isaac-blanc

Description

I would like to freeze the location of my hovertext with a click callback. Once frozen, the hovertext would no longer follow the cursor, but instead be frozen in place. Another click would release the hovertext, so that it follows the cursor again. I feel like this should be possible by temporarily disabling the internal plotly callback that moves the hovertext with the cursor.

Why should this feature be added?

There are two ways for moving the hovertext. You can move it with the cursor or you can move it programmatically with Plotly.Fx.hover. If you are moving the hovertext programmatically, it is helpful to 'turn off' the cursor interaction, otherwise the user may inadvertently move the hovertext when they move the cursor. In my project, the user is trying to find an 'optimal' location in the heatmap. I think it would be useful if they could make an initial placement of hovertext using the cursor, click to freeze it there, and then make subsequent 'tweeks' to the hovertext location using input fields elsewhere in the app.

Mocks/Designs

This prototype is built from the D3.js heatmap example and a global frozen variable as suggested on StackOverflow. Notice how the tooltip follows the cursor until the user clicks, whereupon the tooltip is frozen at the clicked location until the user clicks again and unfreezes the tooltip. I would be happy to neaten & share the code if that would be helpful.

Image

Notes

  • Similar to #7578 but slightly simpler, since I am not seeking to make comparisons between different parts of the same plot.
  • Similar to #998 in the sense that I want to persist the hovertext on click.
  • There is a workaround for temporarily disabling all mouse interactions on StackOverflow.

Activity

  1. MeetRamatri commented on Dec 3, 2025

    @MeetRamatri

    Hey I would love to work on this feature. Kindly assign me this please @isaac-blanc @archmoj @alexcjohnson

  2. isaac-blanc commented on Dec 3, 2025

    @isaac-blanc
    Author

    I should make clear that I only need the plotly.js interface to expose a method for turning cursor interaction on/off. I can hook this up to a click callback myself.

  3. ndrezn commented on Dec 10, 2025

    @ndrezn
    Contributor

    @MeetRamatri feel free to contribute a PR and we'd be happy to review! Once the PR is open and we can review we can update assignments.

  4. Lexachoc commented on Oct 9, 2026

    @Lexachoc
    Contributor

    @MeetRamatri any updates on this?

  5. isaac-blanc commented on Oct 12, 2026

    @isaac-blanc
    Author

    No update from me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions