-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
Fix: Don't sort in pie function #27076
Conversation
Pinging @elastic/kibana-canvas |
💚 Build Succeeded |
c1c1627
to
d191368
Compare
💚 Build Succeeded |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great PR! If one has a single, static pie chart then we most often need value based sorting. As Canvas is data driven, and can sport multiple piecharts on the same page in a grid formation (with like data), these are legit uses:
- if the data gets updated frequently, eg. every few seconds or minutes, an alternative option is to keep slice indices fixed, so that slice areas / angles tween in place, rather than abruptly relocate (though for some purposes, slices rotating into a new position may be desirable, to make shifts in ranking salient)
- when creating a small multiples chart with a row or grid of pie charts (eg. per country sales), per-pie value ordering is often the best, but some users may prefer consistent pie ordering across elements of the small multiple chart
- if the categories form a natural order, this may trump the value order (eg. colors, magnitudes, basically anything that's a discretization of a continuous measure eg. 0 - 10 years old; 10-20 years old etc.) - in these cases, the category order should prevail
It looks like the change can alter preexisting workbooks, which is fine as it's not yet in GA, and it's clearly the better route. The pie
is a renderer and any sorting can be relegated to a previous data processing step, otherwise we'd duplicate and couple data processing in pie
.
Exactly. And any existing pie charts that are not "incorrect" can be fixed by adding a |
Closes #27077
Don't sort data by labels in pie function, so that the user's sorting is preserved. Tests were also removed or updated.
Below, note that the order of the data is preserved in the pie chart, instead of being sorted alphabetically by label name.