Skip to content

Allow access data on the plotly_doubleclick event #7303

Open
@Lexachoc

Description

@Lexachoc

The double click event will trigger the single click event as well as reported in #1546. But the issue has been closed.

Here's the example showing the issue:
https://codepen.io/Lexachoc/pen/qEWZJxb

Only the single click event plotly_click can access the data.

There are usecases to access the data points on double click e.g., in plotly/react-plotly.js#257.

It would be nice to allow access the data also on double click. And maybe also to avoid triggering a single-click event. (which will solve the issue report in #1546)

Activity

Lexachoc

Lexachoc commented on Dec 8, 2024

@Lexachoc
ContributorAuthor

I managed to implement this feature.
Image

But since the double-click event is applied to the whole plot(?), the first response is null, which is fine since I can access the data from the second response.
I reused the plotly_click event, and trigger the second plotly_doubleclick manually, that's why only the second response has point data available.

There's still an issue that the double click on points will force the plot to reset zoom. So I have to prevent the zoom reset if there's hover data.

I would like to hear what the Plotly team thinks about whether or not to add support for accessing data by double-clicking on points. (Of course, don't trigger zoom reset.)

Below is a usecase, double click on the points to show popup information of point (I use a toast for example):

Image

added
P2considered for next cycle
on Dec 9, 2024
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

    P2considered for next cyclefeaturesomething new

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @gvwilson@Lexachoc

        Issue actions

          Allow access data on the `plotly_doubleclick` event · Issue #7303 · plotly/plotly.js