Skip to content

[Feature Request] Allow ordering items by value for unified x hovermode #5362

Closed

Description

@mayeut

At the moment, it seems that order of items is hardcoded in the following line:

legendOpts.entries.sort(function(a, b) { return a[0].trace.index - b[0].trace.index;});

It would be great to allow ordering items by value for unified x hovermode as mentioned in comments #4477 (comment) and #4477 (comment).

Current behavior sample:
Capture d’écran 2020-12-26 à 17 35 32

Desired behavior sample:
Capture d’écran 2020-12-26 à 17 32 42

Activity

  1. mayeut commented on Dec 26, 2020

    @mayeut
    Author

    Might mitigate #4786 in some cases (like the one showed above).

  2. miranda-luna-db commented on Nov 4, 2021

    @miranda-luna-db

    Hi @nicolaskruchten @chriddyp @ndrezn - Any plans to take a look here soon? Right now we're stuck between a choice of (a) covering up the x-axis value on hover but having data nicely sorted and (b) displaying x-axis value but losing data sort.

  3. nicolaskruchten commented on Nov 4, 2021

    @nicolaskruchten
    Contributor

    It's not a bad idea, we could add a flag that would control this behaviour but no one on our team is looking at this at the moment, no. We'd accept a pull request for someone who wanted to implement it though!

  4. nlyle01 commented on Jan 9, 2023

    @nlyle01

    Chiming in to agree with @mayeut; Ordering tooltip by trace value rather than legend order would be super cool

  5. vicn1222 commented on Dec 9, 2023

    @vicn1222

    I am also looking for this feature and stumble on this thread. Has this been implemented yet? Thanks.

  6. JeromeC-B commented on Jan 8, 2024

    @JeromeC-B

    For me, with plotly js, in the plot config, with hovermode = "x", it works.

  7. gvwilson commented on Jul 12, 2024

    @gvwilson
    Contributor

    Hi - we are tidying up stale issues and PRs in Plotly's public repositories so that we can focus on things that are still important to our community. Since this one has been sitting for a while, I'm going to close it; if it is still a concern, please add a comment letting us know what recent version of our software you've checked it with so that I can reopen it and add it to our backlog. If you'd like to submit a PR, we'd be happy to prioritize a review, and if it's a request for tech support, please post in our community forum. Thank you - @gvwilson

  8. KacemKhaled commented on Apr 9, 2025

    @KacemKhaled

    plotly==5.24.1 the functionality is still not there
    Can you please re-open this issue?

  9. gvwilson commented on Apr 9, 2025

    @gvwilson
    Contributor

    @KacemKhaled reopened, but we have no plans to implement this - we'd be happy to prioritize review of a PR from the community. thanks - @gvwilson

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

    P3backlogfeaturesomething new

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions