feat: fill multi-series with missing x values data points#409
Merged
markov00 merged 2 commits intoelastic:masterfrom Oct 9, 2019
Merged
feat: fill multi-series with missing x values data points#409markov00 merged 2 commits intoelastic:masterfrom
markov00 merged 2 commits intoelastic:masterfrom
Conversation
Codecov Report
@@ Coverage Diff @@
## master #409 +/- ##
==========================================
- Coverage 98% 97.95% -0.05%
==========================================
Files 39 39
Lines 2853 2887 +34
Branches 681 692 +11
==========================================
+ Hits 2796 2828 +32
- Misses 50 52 +2
Partials 7 7
Continue to review full report at Codecov.
|
When displaying a stacked area/line chart with multiple data sets we need to fill the dataset with zeros on missing data points. The rendering is affected also: it will hide the filled missing point but will continue to show the area beneath it. fix elastic#388
89c9c48 to
64a3c9e
Compare
nickofthyme
approved these changes
Oct 9, 2019
| } | ||
|
|
||
| export interface DataSeriesDatum { | ||
| /** the x value */ |
| rawDataSeries: RawDataSeries[]; | ||
| colorsValues: Map<string, any[]>; | ||
| xValues: Set<any>; | ||
| xValues: Set<string | number>; |
Collaborator
There was a problem hiding this comment.
nice I like the no any!
| for (let x of missingXValues.values()) { | ||
| const stack = stackMap.get(x) || new Array(dataseries.length).fill(0); | ||
| // currently filling as 0 value | ||
| stack[index] = 0; |
| } | ||
| } | ||
| newData.sort((a, b) => { | ||
| if (xScaleType === ScaleType.Ordinal || typeof a.x === 'string' || typeof b.x === 'string') { |
| return legendValues.map((value, index) => { | ||
| const yAccessor: AccessorType = index === 0 ? AccessorType.Y1 : AccessorType.Y0; | ||
| return ( | ||
| <LegendItem |
Collaborator
There was a problem hiding this comment.
👍 I missed that it was in a div 🤦♂
Collaborator
Author
|
🎉 This PR is included in version 13.5.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
AMoo-Miki
pushed a commit
to AMoo-Miki/OpenSearch-Dashboards
that referenced
this pull request
Feb 10, 2022
# [13.5.0](elastic/elastic-charts@v13.4.1...v13.5.0) (2019-10-09) ### Features * **data:** fill datasets with zeros with missing points when stacked ([opensearch-project#409](elastic/elastic-charts#409)) ([b989074](elastic/elastic-charts@b989074)), closes [opensearch-project#388](elastic/elastic-charts#388)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
fix #388
Before the fix
After the fix:
Checklist
Use
strikethroughsto remove checklist items you don't feel are applicable to this PR.src/index.ts(and stories only import from../srcexcept for test data & storybook)