-
Notifications
You must be signed in to change notification settings - Fork 13.7k
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(plugin-chart-echarts): add series sorting #23392
Conversation
aggregator = name => ({ name, value: meanBy(rows, name) }); | ||
break; | ||
default: | ||
aggregator = name => ({ name, value: name.toLowerCase() }); |
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.
Note that we're now sorting case insensitive (previously "Qwerty" would come before "abc")
Codecov Report
@@ Coverage Diff @@
## master #23392 +/- ##
===========================================
- Coverage 67.53% 56.28% -11.26%
===========================================
Files 1907 1907
Lines 73473 73518 +45
Branches 7976 7980 +4
===========================================
- Hits 49617 41376 -8241
- Misses 21807 30094 +8287
+ Partials 2049 2048 -1
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 297 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. 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.
Love that upgrade, charts look so much better now!
27ec70f
to
4b2f3ac
Compare
(cherry picked from commit 0c454c6)
(cherry picked from commit 0c454c6)
Removing the 2.1.1 tags since this is a feature. We'll instead get this PR into 3.0 |
SUMMARY
Currently the ECharts area chart sorts series in ascending order based on the series name. This is different from the NVD3 plugin, which always places the biggest series on the bottom (this applies to the bar chart as well). This PR adds the possibility to sort by not only the series name, but also the min, max, total and average series values, along with making the sort order switchable. To achieve parity with the NVD3 plugin, we change the default behavior to sort by the sum in descending order, essentially placing the largest series on the bottom. Also, to make sure the tooltip is ordered more intuitively, we reorder the tooltip labels in reverse order when stacking to place the first element (=the lowest series) last.
AFTER
Now the series are ordered from largest to smallest, similarly to how the NVD3 plugin does it. Also notice the order of items on the tooltip, which is in line with the series on the chart:
The new controls render in real time:
echarts-sort.mp4
BEFORE
Previously the series were always ordered based on the series name. Also notice that "other" is placed after "TX" due to case sensitive ordering, and that the order is reversed on the tooltip:
TESTING INSTRUCTIONS
ADDITIONAL INFORMATION