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(domain): scale data to a specific domain via axis spec #98

Merged
merged 24 commits into from
Mar 19, 2019

Conversation

emmacunningham
Copy link
Contributor

@emmacunningham emmacunningham commented Mar 13, 2019

Summary

close #86

This PR introduces the feature to specify custom domains for a series. There are two types of domains to customize: xDomain and yDomains.

xDomain

xDomain is configured via the Settings spec because the xDomain is shared globally and so the user should only be able to configure one xDomain.

  • For ordinal domains, the user will define an array of values. (If they include values that aren't in the data, these will just appear as gaps.) The order of the values will be how they appear along the axis.

custom_x_domain_ordinal

  • For other domain types, the user supplies a domain with min & max.
    custom_x_domain

yDomains

yDomains are configured per axis/group.
custom_y_domain

  • If a domain is supplied for an axis that is an xDomain axis, an error will be thrown, letting the user know that this should be added through the Settings spec.

  • If a user specifies multiple domains for the same group (which can be done when having multiple axes), then the domains are merged to cover the largest range of the supplied domains (e.g. if { min: 0, max: 5 } and { min: 1, max: 15 } are provided as the domains for the same group, then the merged domain applied would be { min : 0, max: 15 })

custom_y_domain_merge

Also, to allow the user to specify a custom domain but not show the axis, we implement the hide feature.

hide_axis

Custom domain w/ hidden axis:

hide_axis_custom

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 added wip work in progress :axis Axis related issue :data Data/series/scales related issue :specs Chart specifications related issue labels Mar 13, 2019
@emmacunningham emmacunningham marked this pull request as ready for review March 14, 2019 20:56
@codecov-io
Copy link

codecov-io commented Mar 14, 2019

Codecov Report

Merging #98 into master will increase coverage by 0.22%.
The diff coverage is 95.65%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #98      +/-   ##
==========================================
+ Coverage   88.63%   88.86%   +0.22%     
==========================================
  Files          28       28              
  Lines        1144     1167      +23     
  Branches      118      119       +1     
==========================================
+ Hits         1014     1037      +23     
+ Misses        120      119       -1     
- Partials       10       11       +1
Impacted Files Coverage Δ
src/lib/series/specs.ts 100% <ø> (ø) ⬆️
src/state/utils.ts 72.72% <100%> (ø) ⬆️
src/lib/axes/axis_utils.ts 99.51% <100%> (+0.01%) ⬆️
src/lib/series/domains/x_domain.ts 100% <100%> (ø) ⬆️
src/lib/series/domains/y_domain.ts 98.41% <100%> (+1.69%) ⬆️
src/state/chart_state.ts 98.94% <100%> (ø) ⬆️
src/lib/utils/dimensions.ts 76.92% <100%> (+2.41%) ⬆️
src/lib/series/rendering.ts 40.42% <75%> (+3.84%) ⬆️

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 311aa85...5516d55. Read the comment docs.

@markov00 markov00 mentioned this pull request Mar 18, 2019
93 tasks
@emmacunningham emmacunningham removed the wip work in progress label Mar 18, 2019
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, tested locally.
I've left few minor comments on code.

src/lib/axes/axis_utils.test.ts Outdated Show resolved Hide resolved
src/lib/axes/axis_utils.ts Outdated Show resolved Hide resolved
src/lib/series/domains/x_domain.ts Outdated Show resolved Hide resolved
src/lib/series/domains/x_domain.test.ts Outdated Show resolved Hide resolved
src/lib/series/domains/y_domain.ts Show resolved Hide resolved
src/state/utils.ts Outdated Show resolved Hide resolved
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.

Changes after review LGTM.

@emmacunningham emmacunningham merged commit b039ebf into elastic:master Mar 19, 2019
markov00 pushed a commit that referenced this pull request Mar 19, 2019
# [3.2.0](v3.1.1...v3.2.0) (2019-03-19)

### Features

* **domain:** scale data to a specific domain via axis spec ([#98](#98)) ([b039ebf](b039ebf))
@markov00
Copy link
Member

🎉 This PR is included in version 3.2.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@markov00 markov00 added the released Issue released publicly label Mar 19, 2019
@markov00 markov00 modified the milestone: 7.1 Mar 26, 2019
AMoo-Miki pushed a commit to AMoo-Miki/OpenSearch-Dashboards that referenced this pull request Feb 10, 2022
# [3.2.0](elastic/elastic-charts@v3.1.1...v3.2.0) (2019-03-19)

### Features

* **domain:** scale data to a specific domain via axis spec ([opensearch-project#98](elastic/elastic-charts#98)) ([4857e42](elastic/elastic-charts@4857e42))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:axis Axis related issue :data Data/series/scales related issue released Issue released publicly :specs Chart specifications related issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Scale data to specific domain
3 participants