fix: adjust domain & range for single value histogram#265
Merged
emmacunningham merged 4 commits intoelastic:masterfrom Jul 17, 2019
Merged
fix: adjust domain & range for single value histogram#265emmacunningham merged 4 commits intoelastic:masterfrom
emmacunningham merged 4 commits intoelastic:masterfrom
Conversation
Codecov Report
@@ Coverage Diff @@
## master #265 +/- ##
==========================================
+ Coverage 98.12% 98.19% +0.07%
==========================================
Files 36 37 +1
Lines 2662 3319 +657
Branches 607 821 +214
==========================================
+ Hits 2612 3259 +647
- Misses 45 50 +5
- Partials 5 10 +5
Continue to review full report at Codecov.
|
markov00
reviewed
Jul 17, 2019
Collaborator
markov00
left a comment
There was a problem hiding this comment.
Code LGTM just added a minor comment. Tested locally.
32 tasks
markov00
pushed a commit
that referenced
this pull request
Jul 17, 2019
## [8.0.2](v8.0.1...v8.0.2) (2019-07-17) ### Bug Fixes * adjust domain & range for single value histogram ([#265](#265)) ([3f1358e](3f1358e))
Collaborator
|
🎉 This PR is included in version 8.0.2 🎉 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
## [8.0.2](elastic/elastic-charts@v8.0.1...v8.0.2) (2019-07-17) ### Bug Fixes * adjust domain & range for single value histogram ([opensearch-project#265](elastic/elastic-charts#265)) ([98c2a9f](elastic/elastic-charts@98c2a9f))
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 #262
Previously, a line annotation within a single value histogram's domain range would not appear correctly, rendering the line at the domain start position. For example with a single value histogram with domain
3to4, an annotation line at3.5would be rendered at3. This PR adds handling for computing the x scale for a single value histogram such that the line now correctly renders in the right position:The issue was that the annotations rely on the xScale for the x-axis position but with a single value domain, calling
xScale.scalewould return0for all values because the domain and range passed into the scale constructor created a scale that could not compute the right values because the domain would be single value ([3, 3]for our example) and the range would also be single value ([0, 0]in the example here).To address this, we now do a check in
computeXScalesuch that if theenableHistogramModeflag is true and the domain is a single value domain, we adjust the domain and range values passed into the constructor so that the returned scale's domain and range have been adjusted to account for histogram mode (the domain is extended by theminInterval, which will default to1unless the user passes in a customminIntervalforxDomain).Checklist
Use
strikethroughsto remove checklist items you don't feel are applicable to this PR.- [ ] Any consumer-facing exports were added tosrc/index.ts(and stories only import from../srcexcept for test data & storybook)