Skip to content

dataIndex sort predicate is not properly respected #1593

@markov00

Description

@markov00

Describe the issue
In the cartesia charts, the small multiple sort predicate dataIndex doesn't use the data index, but just fallback to numAsc, and is not possible to pass a sorted array and have the small multiple dataset sorted by the small multiple value by array index.

  default:
    case 'dataIndex':
    case 'numAsc':
      return (a: T, b: T) => {
        const aValue = Number(accessor ? a[accessor] : a);
        const bValue = Number(accessor ? b[accessor] : b);
        return aValue - bValue;
      };
  }

Expected behaviour
When specifying dataIndex in the sort predicate, the data should reuse the index of the data when it was passed to the chart.

Kibana Cross Issues
elastic/kibana#124318 (comment)

Checklist

  • The proper chart type label has been added (e.g. :xy, :partition)
  • Every related Kibana issue is listed under Kibana Cross Issues list and the kibana cross issue tag is applied

Metadata

Metadata

Assignees

No one assigned

    Labels

    :small multiplesSmall multiples/trellising related issues:xyBar/Line/Area chart relatedbugSomething isn't workingkibana cross issueHas a Kibana issue counterpart

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions