-
Notifications
You must be signed in to change notification settings - Fork 120
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(legend): display series value (dependent on hover) & sort in legend #155
feat(legend): display series value (dependent on hover) & sort in legend #155
Conversation
Codecov Report
@@ Coverage Diff @@
## master #155 +/- ##
==========================================
+ Coverage 94.06% 94.28% +0.21%
==========================================
Files 34 34
Lines 1753 1801 +48
Branches 223 228 +5
==========================================
+ Hits 1649 1698 +49
Misses 90 90
+ Partials 14 13 -1
Continue to review full report at Codecov.
|
@markov00 Can address |
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.
@emmacunningham I'm not sure sorting by the last bucket is the right way to do it because sorting happens on ES side and can depends on a different aggregation value. In the following snapshots you can see that with the same aggregation, I can sort by count of elements in the bucket or by average bytes.
I think we can propose something like adding an index
prop to each series/subseries to enable sorting and let ES decide the right order on its values keeping also the ascending/descending property out our our charts.
if will be awesome if we can add in the future (not needed on this PR) also an index for each element, because happens that when sorting on es, each bucket can be sorted differently, in that case something like an indexAccessor
can be a good way to implement (that is the element index on the array by default).
This reverts commit 2d0a815.
@markov00 Have removed the props to specify ascendin or descending and instead added a series spec |
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.
Code LGTM, tested locally and works fine expect two minor issue to notice:
If you hide a series from the legend, the series value is no longer updated. I think a better UX should be to hide also the last bucket value if the series is hidden on the legend
This other issue is marginal and can be resolved when the design team will take care a bit of how we can design this legend. on horizontal legend the legend value is pushed to the end of the line. This is caused by the use of flexbox for making a grid like that.
@markov00 have updated the legend element so that when the series is not visible, the display value also is hidden will add the horizontal legend position issue to the issue tracking legend styling! |
# [3.9.0](v3.8.0...v3.9.0) (2019-04-10) ### Features * **legend:** display series value (dependent on hover) & sort in legend ([#155](#155)) ([78af858](78af858))
🎉 This PR is included in version 3.9.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
# [3.9.0](elastic/elastic-charts@v3.8.0...v3.9.0) (2019-04-10) ### Features * **legend:** display series value (dependent on hover) & sort in legend ([opensearch-project#155](elastic/elastic-charts#155)) ([ebdb000](elastic/elastic-charts@ebdb000))
Summary
close #143
close #133
This PR adds the feature to display a value next to a legend item, where the value is either the current value of the crosshair tooltip or, if there is no corresponding tooltip value the last value in the series.
A prop on the Settings spec
showLegendDisplayValue
(defaulttrue
) will toggle the appearence of the value. The screencap below also shows how the additional value displays for each legend Position option.The legend items are sorted by a specified
sortIndex
on theSeriesSpec
(defaultundefined
, whereundefined
items will appear last). We will separately add the feature to enable subseries sorting by allowing the user to specify asortIndexAccessor
(see this comment).Checklist
Use
strikethroughsto remove checklist items you don't feel are applicable to this PR.