Skip to content

Sorting a line chart with multiple traces messes up order of traces #4711

Closed as not planned

Description

@mtadams007

Hi,

I've been working on sorting charts and originally used

 transforms: [
                {
                  type: "sort",
                  target: "y",
                  order: "ascending"
                }
              ]

in order to sort them. This works fine if I only have one trace, but with multiple traces it changes the order of a line chart which causes it to zigzag. See example at https://codepen.io/mtadams007/pen/LYVqQjX?editors=0010

I would expect to be able to add the transforms attribute to one trace which reorders the x axis so all the following traces follow the same order.

I saw that you recently updated the docs, but I couldn't find any documentation on transforms in them. Am I missing something?

Thanks!

Activity

  1. oshikryu commented on May 19, 2020

    @oshikryu
    Contributor

    Here's a few references I found related to target within the transform method:

    interpreting target
    https://github.com/plotly/plotly.js/blob/master/src/lib/index.js#L624-L645

    getTargetArray
    https://github.com/plotly/plotly.js/blob/master/src/transforms/sort.js#L31-L51

    An example with filter and aggregate (unfortunately no sort)
    https://plotly.com/javascript/multiple-transforms/#filter-and-aggregates

  2. self-assigned this
    on Jun 17, 2024
  3. removed their assignment
    on Aug 2, 2024
  4. emilykl commented on Aug 27, 2026

    @emilykl
    Contributor

    Closing this issue because transforms was removed from the API in #7240.

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

    P3backlogbugsomething broken

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions