Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(xy): render sorting #2524

Merged
merged 35 commits into from
Oct 8, 2024
Merged

feat(xy): render sorting #2524

merged 35 commits into from
Oct 8, 2024

Conversation

nickofthyme
Copy link
Collaborator

@nickofthyme nickofthyme commented Sep 13, 2024

Summary

Adds render sorting for xy charts. See demo story here.

Zight Recording 2024-09-12 at 07 02 47 PM

Details

Render order

  • Default sort based on data order
  • Override default sort with Settings.renderSort function

Legend items order

  • Default to opposite of render order
  • Override default using Settings.legendSort, original array is based on render order.

Tooltip items order

  • Default to match legend order
  • Override default using Tooltip.sort, original array is based on render order.

Breaking changes

The way mixed stacked/nonstacked series are colored now is different from the previous behaviour. Now we color them not by their insert index but by the way we display them in the rendering: from the left to right, bottom top, stacked, nonstacked. This align correctly also the legend colors by default. This does not affect colors assigned via a SeriesColorAccessor.

Screenshot 2024-10-08 at 09 48 24

Issues

Related to elastic/kibana#191988

Checklist

  • The proper chart type label has been added (e.g. :xy, :partition)
  • The proper feature labels have been added (e.g. :interactions, :axis)
  • All related issues have been linked (i.e. closes #123, fixes #123)
  • New public API exports have been added to packages/charts/src/index.ts
  • Unit tests have been added or updated to match the most common scenarios
  • The proper documentation and/or storybook story has been added or updated

@nickofthyme nickofthyme added enhancement New feature or request :data Data/series/scales related issue :xy Bar/Line/Area chart related labels Sep 13, 2024
@nickofthyme
Copy link
Collaborator Author

buildkite update screenshots

@nickofthyme nickofthyme marked this pull request as ready for review September 17, 2024 22:01
@nickofthyme
Copy link
Collaborator Author

buildkite update screenshots

Copy link
Member

@markov00 markov00 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, thanks.
With this change, and my applied changes, we need to specify this as a breaking change. In the mixed stacked/nonstacked environment, the color assigned is inverted: first, the stacked then the non-stacked, the same way you read the chart left-right.
Please mark this as breaking change when merging.

@nickofthyme nickofthyme merged commit c514571 into elastic:main Oct 8, 2024
14 checks passed
@nickofthyme nickofthyme deleted the xy-sorting branch October 8, 2024 14:57
nickofthyme pushed a commit that referenced this pull request Oct 8, 2024
# [68.0.0](v67.0.1...v68.0.0) (2024-10-08)

### Features

* **xy:** render sorting ([#2524](#2524)) ([c514571](c514571))

### BREAKING CHANGES

* **xy:** The way mixed stacked/nonstacked series are colored now is different from the previous behaviour. Now we color them not by their insert index but by the way we display them in the rendering: from the left to right, bottom top, stacked, nonstacked. This align correctly also the legend colors by default. This does **not** affect colors assigned via a `SeriesColorAccessor`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:data Data/series/scales related issue enhancement New feature or request :xy Bar/Line/Area chart related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants