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: add chart size type overrides #317

Merged
merged 4 commits into from
Aug 19, 2019
Merged

Conversation

markov00
Copy link
Member

@markov00 markov00 commented Aug 16, 2019

Summary

fix #177

Add multiple override types for <Chart> size props.

The size parameters now accept ChartSize:

type ChartSize = number | string | ChartSizeArray | ChartSizeObject;
type ChartSizeArray = [number | string | undefined, number | string | undefined];
type ChartSizeObject = {
  width?: number | string;
  height?: number | string;
}

The default value for an undefined parameter is 100%.

Checklist

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

  • Any consumer-facing exports were added to src/index.ts (and stories only import from ../src except for test data & storybook)
  • 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

Now the Chart size prop takes multiple types as input: basic string or number, a tuple of string or
number or undefined, an object with width and height (string, number or optionals).

fix elastic#177
@markov00 markov00 added :chart Chart element related issue bug Something isn't working labels Aug 16, 2019
@markov00 markov00 requested a review from nickofthyme August 16, 2019 09:17
@markov00 markov00 changed the title Chart size feat: add chart size type overrides Aug 16, 2019
@codecov-io
Copy link

codecov-io commented Aug 16, 2019

Codecov Report

Merging #317 into master will increase coverage by 0.06%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master    #317      +/-   ##
=========================================
+ Coverage   98.04%   98.1%   +0.06%     
=========================================
  Files          37      38       +1     
  Lines        2715    2855     +140     
  Branches      636     692      +56     
=========================================
+ Hits         2662    2801     +139     
  Misses         48      48              
- Partials        5       6       +1
Impacted Files Coverage Δ
src/utils/chart_size.ts 100% <100%> (ø)
src/chart_types/xy_chart/store/chart_state.ts 96.74% <0%> (-0.14%) ⬇️
src/chart_types/xy_chart/utils/axis_utils.ts 100% <0%> (ø) ⬆️
src/chart_types/xy_chart/utils/dimensions.ts 85% <0%> (+5%) ⬆️

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 7699f72...3330002. Read the comment docs.

Copy link
Collaborator

@nickofthyme nickofthyme left a comment

Choose a reason for hiding this comment

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

LGTM, just one suggestion

src/utils/chart_size.ts Outdated Show resolved Hide resolved
src/utils/chart_size.ts Outdated Show resolved Hide resolved
src/utils/chart_size.ts Outdated Show resolved Hide resolved
@markov00 markov00 mentioned this pull request Aug 16, 2019
25 tasks
@markov00 markov00 requested a review from nickofthyme August 16, 2019 22:46
@markov00 markov00 merged commit b8dc9e1 into elastic:master Aug 19, 2019
markov00 pushed a commit that referenced this pull request Aug 19, 2019
# [9.2.0](v9.1.1...v9.2.0) (2019-08-19)

### Bug Fixes

* reduce opacity for points when hovering over legend items ([#322](#322)) ([196341b](196341b)), closes [#291](#291)

### Features

* add chart size type overrides ([#317](#317)) ([b8dc9e1](b8dc9e1)), closes [#177](#177)
@markov00
Copy link
Member Author

🎉 This PR is included in version 9.2.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@markov00 markov00 added the released Issue released publicly label Aug 19, 2019
@markov00 markov00 deleted the chart-size branch November 25, 2020 11:43
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
bug Something isn't working :chart Chart element related issue released Issue released publicly
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Chart size attribute type doesn't support "100%" as a valid size
3 participants