Skip to content

[Lens] Allow client-side sorting of dimensions and legends at datasource level for all chart types #86184

@wylieconlon

Description

@wylieconlon

Primary capabilities we expect from this feature

  1. Sorting data by metrics when underlying API does not offer a sort (see cases below)
  2. Legend sorting

User story

Sort order affects the understanding of the data, but not all charts allow custom sorting. This is a frequently-requested feature when users run into one of the aggregation limits of Elasticsearch. Here are some example use cases and limitations:

Sorting data by metrics / methods underlying API does not offer

  1. Metric sort - Changing the filter order based on the count or other metric
  2. Metric sort, percentiles - Sorting terms by percentiles
  3. Metric sort - formula/columnwise math: Sorting based on a calculation, for example sorting by derivative
  4. Explicit sort Assigning a predefined order to Terms based on a list of known terms
  5. Offering sort using both axis - Sorting both axes of a heatmap by ascending order, not just one
  6. Sorting on both categorical groupings independently. Occurs in 1) heatmaps 2) mosaic 3) grouped bars 4) pie/donut

Sorting the legend separately from visualization

  1. Legend metric sort - sorting the vis on metric but legend alphabetically
  2. Explicit legend sort - assigning a predefined order to Terms based on a list of known terms

Example before and after

This visualization is using math to calculate the "max - min" value per bar. The natural sort order is not helpful, so we actually want to apply client-side sorting based on the number displayed:

Screen Shot 2020-12-16 at 3 30 28 PM Screen Shot 2020-12-16 at 3 30 51 PM

Proposed functionality

Each dimension will offer an advanced setting that does client-side sorting, visible in the flyout editor. This setting would be called "Sort override" and have the options "No override", "Ascending" and "Descending". Numbers and dates would be sorted based on the raw value, and all other types would be sorted based on the formatted value.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Feature:LensTeam:VisualizationsTeam label for Lens, elastic-charts, Graph, legacy editors (TSVB, Visualize, Timelion) t//enhancementNew value added to drive a business resultimpact:highAddressing this issue will have a high level of impact on the quality/strength of our product.

    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