-
Notifications
You must be signed in to change notification settings - Fork 122
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: adjust domain & range for single value histogram #265
fix: adjust domain & range for single value histogram #265
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.
|
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 just added a minor comment. Tested locally.
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.
LGTM!
## [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))
🎉 This PR is included in version 8.0.2 🎉 The release is available on: Your semantic-release bot 📦🚀 |
## [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))
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
3
to4
, an annotation line at3.5
would 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.scale
would return0
for 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
computeXScale
such that if theenableHistogramMode
flag 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 to1
unless the user passes in a customminInterval
forxDomain
).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../src
except for test data & storybook)