feat(xy): specify pixel width for bars#1114
Conversation
…tic-charts into 2021_04_12-fixed_bar_width
monfera
left a comment
There was a problem hiding this comment.
Looks good, minor comments added
Codecov Report
@@ Coverage Diff @@
## master #1114 +/- ##
==========================================
+ Coverage 72.09% 72.61% +0.51%
==========================================
Files 382 398 +16
Lines 11953 12270 +317
Branches 2613 2644 +31
==========================================
+ Hits 8618 8910 +292
- Misses 3310 3327 +17
- Partials 25 33 +8
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
nickofthyme
left a comment
There was a problem hiding this comment.
Looks good to me. Two minor comments
stories/stylings/10_custom_bars.tsx
Outdated
| }; | ||
|
|
||
| const theme = { | ||
| const theme: RecursivePartial<Theme> = { |
There was a problem hiding this comment.
nit
| const theme: RecursivePartial<Theme> = { | |
| const theme: PartialTheme = { |
src/utils/themes/theme.ts
Outdated
| /** The width of the rect in pixel */ | ||
| widthPixel?: Pixels; | ||
| /** The ratio of the width limited to [0,1] */ | ||
| widthRatio?: Ratio; |
There was a problem hiding this comment.
Can we add a comment here about using both?
If both are expressed, then the widthRatio will express the max available size, where the widthPixel express the derired/min width.
# [28.1.0](v28.0.1...v28.1.0) (2021-04-13) ### Bug Fixes * **legend:** sizing for short labels with scrollbar ([#1115](#1115)) ([6e1f223](6e1f223)) * **xy:** negative bar highlight and click ([#1109](#1109)) ([ec17cb2](ec17cb2)), closes [#1100](#1100) ### Features * **a11y:** improve chart figure ([#1104](#1104)) ([815cf39](815cf39)) * **partition:** order slices and sectors ([#1112](#1112)) ([74df29b](74df29b)) * **partitions:** small multipies events pass on smAccessorValue ([#1106](#1106)) ([a3234fe](a3234fe)) * **xy:** optionally rounds the domain to nice values ([#1087](#1087)) ([f644cc4](f644cc4)) * **xy:** specify pixel and ratio width for bars ([#1114](#1114)) ([58de413](58de413)) * mosaic ([#1113](#1113)) ([64bdd88](64bdd88))
|
🎉 This PR is included in version 28.1.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
# [28.1.0](elastic/elastic-charts@v28.0.1...v28.1.0) (2021-04-13) ### Bug Fixes * **legend:** sizing for short labels with scrollbar ([opensearch-project#1115](elastic/elastic-charts#1115)) ([ebf2552](elastic/elastic-charts@ebf2552)) * **xy:** negative bar highlight and click ([opensearch-project#1109](elastic/elastic-charts#1109)) ([065673c](elastic/elastic-charts@065673c)), closes [opensearch-project#1100](elastic/elastic-charts#1100) ### Features * **a11y:** improve chart figure ([opensearch-project#1104](elastic/elastic-charts#1104)) ([373ea72](elastic/elastic-charts@373ea72)) * **partition:** order slices and sectors ([opensearch-project#1112](elastic/elastic-charts#1112)) ([72c0d1b](elastic/elastic-charts@72c0d1b)) * **partitions:** small multipies events pass on smAccessorValue ([opensearch-project#1106](elastic/elastic-charts#1106)) ([0e1f7de](elastic/elastic-charts@0e1f7de)) * **xy:** optionally rounds the domain to nice values ([opensearch-project#1087](elastic/elastic-charts#1087)) ([9c2eefc](elastic/elastic-charts@9c2eefc)) * **xy:** specify pixel and ratio width for bars ([opensearch-project#1114](elastic/elastic-charts#1114)) ([6294d5f](elastic/elastic-charts@6294d5f)) * mosaic ([opensearch-project#1113](elastic/elastic-charts#1113)) ([15c0d78](elastic/elastic-charts@15c0d78))
Summary
This PR adds the ability to specify the width of bars in pixel or as the ratio of the current computed width.
This option is exposed as part of the
BarSeriesStyle.rectobjectIf
widthPixelis used, then each bar width will use exactly that width in pixel. This width is limited to the max width available for the bars (that excludes the bar padding)If
widthRatiois used, then each bar width will use the ratio of the max computed width.If both are expressed, then the
widthRatiowill express the max available size, where thewidthPixelexpress the derired/min width.fix #497
Checklist
Delete any items that do not apply to this PR.
src/index.ts(and stories only import from../srcexcept for test data & storybook)