Skip to content
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: allow partial custom domain #116

Merged
merged 8 commits into from
Mar 25, 2019

Conversation

emmacunningham
Copy link
Contributor

@emmacunningham emmacunningham commented Mar 22, 2019

Summary

re #111

This PR adds the enhancement to defining partially bounded custom domains. Where DomainRange was previously typed as { min: number, max: number }, it now is typed as such:

export type DomainRange = LowerBoundedDomain | UpperBoundedDomain | CompleteBoundedDomain;

export interface LowerBoundedDomain {
  min: number;
}

export interface UpperBoundedDomain {
  max: number;
}

export interface CompleteBoundedDomain {
  min: number;
  max: number;
}

This allows us to flexibly extend the interfaces as needed and also enforce that at least one of max and min are defined (while providing the downstream user with feedback on the type of their config to block {} as a valid prop). [The other benefit to this type is that internally, we can refer to the individual types of bounded domains and use them in a typeguard; see the updated mergeDomainsByGroupId implementation. Additionally, we can use the typeguards when merging X and Y domains.]

For a partial custom domain, we also check its validity (for example, a LowerBoundedDomain should not have a min greater than the max of the computed domain). Currently this throws, but per #117, once there is an agreement on error handling, this may change.

Checklist

Use strikethroughs to remove checklist items you don't feel are applicable to this PR.

- [ ] This was checked for cross-browser compatibility, including a check against IE11

  • Proper documentation or storybook story was added for features that require explanation or tutorials
  • Unit tests were updated or added to match the most common scenarios
  • Each commit follows the convention

@emmacunningham emmacunningham changed the title Feat/partial domain feat: allow partial custom domain Mar 22, 2019
@codecov-io
Copy link

codecov-io commented Mar 22, 2019

Codecov Report

Merging #116 into master will increase coverage by 0.23%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #116      +/-   ##
==========================================
+ Coverage   90.17%   90.41%   +0.23%     
==========================================
  Files          31       31              
  Lines        1405     1439      +34     
  Branches      150      161      +11     
==========================================
+ Hits         1267     1301      +34     
  Misses        125      125              
  Partials       13       13
Impacted Files Coverage Δ
src/lib/series/specs.ts 100% <ø> (ø) ⬆️
src/lib/series/domains/y_domain.ts 100% <100%> (ø) ⬆️
src/lib/series/domains/x_domain.ts 100% <100%> (ø) ⬆️
src/lib/axes/axis_utils.ts 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d498484...9702cb8. Read the comment docs.

@emmacunningham
Copy link
Contributor Author

@markov00 using the typeguards instead of casting as Partial<CompleteBoundedDomain>, see fbbe316

@emmacunningham emmacunningham requested a review from markov00 March 23, 2019 00:19
Copy link
Member

@markov00 markov00 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code LGTM

@emmacunningham emmacunningham merged commit d0b6b19 into elastic:master Mar 25, 2019
markov00 pushed a commit that referenced this pull request Mar 25, 2019
# [3.4.0](v3.3.1...v3.4.0) (2019-03-25)

### Features

* allow partial custom domain ([#116](#116)) ([d0b6b19](d0b6b19))
@markov00
Copy link
Member

🎉 This PR is included in version 3.4.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@markov00 markov00 added the released Issue released publicly label Mar 25, 2019
AMoo-Miki pushed a commit to AMoo-Miki/OpenSearch-Dashboards that referenced this pull request Feb 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
released Issue released publicly
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants