-
Notifications
You must be signed in to change notification settings - Fork 121
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: empty domain error for ordinal x scale #536
fix: empty domain error for ordinal x scale #536
Conversation
@@ -93,6 +93,11 @@ export function mergeXDomain( | |||
minInterval = customMinInterval || computedMinInterval; | |||
} | |||
|
|||
// TODO: Check for empty data before computing domain | |||
if (seriesXComputedDomains.length === 0) { | |||
seriesXComputedDomains = [0, 0]; |
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.
This should be just one single value [0]
because we are in ordinal domain and we don't want duplicated domain values
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.
it's also better to move that inside the computeOrdinalDataDomain
of domains.ts
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.
Codecov Report
@@ Coverage Diff @@
## master #536 +/- ##
==========================================
+ Coverage 75.56% 75.81% +0.24%
==========================================
Files 181 193 +12
Lines 5689 5846 +157
Branches 1103 1117 +14
==========================================
+ Hits 4299 4432 +133
- Misses 1374 1397 +23
- Partials 16 17 +1
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.
LGTM
## [17.0.2](v17.0.1...v17.0.2) (2020-02-05) ### Bug Fixes * empty domain error for ordinal x scale ([#536](#536)) ([ce4e84f](ce4e84f))
🎉 This PR is included in version 17.0.2 🎉 The release is available on: Your semantic-release bot 📦🚀 |
## [17.0.2](elastic/elastic-charts@v17.0.1...v17.0.2) (2020-02-05) ### Bug Fixes * empty domain error for ordinal x scale ([opensearch-project#536](elastic/elastic-charts#536)) ([2e92609](elastic/elastic-charts@2e92609))
Summary
Fixes issue related to empty domain.
If the data is an empty array and the
xScaleType
isOrdinal
thescaleBand
fromd3-scale
will runAnd throw a
RangeError
. This is a quick fix, but ideally, we revisit this to avoid unnecessarily computing the domain if the data is empty for all specs.Checklist