-
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(annotations): provide fallback for line annotation markers #1091
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1091 +/- ##
==========================================
+ Coverage 71.82% 72.14% +0.32%
==========================================
Files 381 397 +16
Lines 11917 12232 +315
Branches 2600 2628 +28
==========================================
+ Hits 8559 8825 +266
- Misses 3327 3368 +41
- Partials 31 39 +8
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
// catch the case of a chart with no axes nor specMarkerPosition for a vertical line annotation | ||
if (!axisPosition && !specMarkerPosition && isXDomain) { | ||
return Position.Bottom; | ||
} |
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.
Can you please check the getDefaultMarkerPositionFromAxis
function? I see that this also covers the case where the axisPosition
is undefined
but I don't know if we are considering all the cases.
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.
Thank you! 2b4f5de
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.
Left few comments: in particular, it needs to account for rotations.
Can you also please add a specific VRT that changes the rotation and checks the 4 rotations values screenshots?
@@ -310,7 +309,7 @@ function getDefaultMarkerPositionFromAxis( | |||
if (axisPosition) { | |||
return axisPosition; | |||
} | |||
if ((isXDomain && isHorizontal) || (!isXDomain && !isHorizontal)) { | |||
if (!isXDomain && isHorizontal) { |
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 doesn't covers all the cases. Please check and fix this to cover the case where the chart is rotated 90,-90 degrees.
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.
Thank you! Please see changes in e58089a 🙇♀️
@@ -283,10 +283,9 @@ function getAnchorPosition( | |||
isXDomain: boolean, | |||
isChartHorizontal: boolean, | |||
specMarkerPosition?: Position, | |||
axisPosition?: Position, | |||
axisPosition?: Position | undefined, |
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 argument is already optional when using the ?
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.
changed in e58089a thank you!
@@ -297,7 +296,7 @@ function getAnchorPosition( | |||
|
|||
function validateMarkerPosition(isXDomain: boolean, isHorizontal: boolean, position: Position): Position | undefined { | |||
if ((isXDomain && isHorizontal) || (!isXDomain && !isHorizontal)) { | |||
return position === Position.Top || position === Position.Bottom ? position : undefined; | |||
return position === Position.Top || position === Position.Bottom ? position : Position.Bottom; |
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 defaults to the dflPositionFromAxis
if the configured specMarkerPosition
doesn't pass this validation.
It's better to keep the defaults in a single place
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.
Yep! Fixed in e58089a thank you
I was facing an issue in three stories (http://localhost:9001/?path=/story/bar-chart--functional-accessors, http://localhost:9001/?path=/story/annotations-rects--linear-bar-chart and https://elastic.github.io/elastic-charts/?path=/story/annotations-rects--ordinal-bar-chart) that were solved by this fix: storybookjs/storybook#6981 (comment) seen in commit e58089a |
The Workflow run is cancelling this PR. It is an earlier duplicate of 1821200 run. |
jenkins test this - accessibility test is flakey but has passed in 8c5e803 |
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.
I haven't understood why we need to use that and what changed on master.
I've checked the currently deployed storybook and seems to work pretty well the text here.
Can you please run a rm -rf node_modules && yarn install to clean up the dependencies and checks if the problem persist without the marked dependency?
You were right! Thanks! 0ba5d9b |
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.
All good for me! thanks for the changes
# [28.0.0](v27.0.0...v28.0.0) (2021-04-02) ### Bug Fixes * **annotations:** provide fallback for line annotation markers ([#1091](#1091)) ([0bd61f1](0bd61f1)) * **legend:** action sizing ui and focus states ([#1102](#1102)) ([3a76a2c](3a76a2c)) * **legend:** stop legend color picker dot twitching ([#1101](#1101)) ([c89b767](c89b767)) ### Code Refactoring * rename enum types to singular ([#1064](#1064)) ([396b3d1](396b3d1)), closes [#767](#767) ### BREAKING CHANGES * `AnnotationDomainTypes`, `AnnotationTypes`, `SeriesTypes`, `ChartTypes`, and `SpecTypes` are renamed to `AnnotationDomainType`, `AnnotationType`, `SeriesType`, `ChartType`, and `SpecType`
🎉 This PR is included in version 28.0.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
# [28.0.0](elastic/elastic-charts@v27.0.0...v28.0.0) (2021-04-02) ### Bug Fixes * **annotations:** provide fallback for line annotation markers ([opensearch-project#1091](elastic/elastic-charts#1091)) ([d907c81](elastic/elastic-charts@d907c81)) * **legend:** action sizing ui and focus states ([opensearch-project#1102](elastic/elastic-charts#1102)) ([a58cc0a](elastic/elastic-charts@a58cc0a)) * **legend:** stop legend color picker dot twitching ([opensearch-project#1101](elastic/elastic-charts#1101)) ([f63bb3b](elastic/elastic-charts@f63bb3b)) ### Code Refactoring * rename enum types to singular ([opensearch-project#1064](elastic/elastic-charts#1064)) ([6e900e2](elastic/elastic-charts@6e900e2)), closes [opensearch-project#767](elastic/elastic-charts#767) ### BREAKING CHANGES * `AnnotationDomainTypes`, `AnnotationTypes`, `SeriesTypes`, `ChartTypes`, and `SpecTypes` are renamed to `AnnotationDomainType`, `AnnotationType`, `SeriesType`, `ChartType`, and `SpecType`
Summary
Fixes #1036
In the playground, if there is no
SpecMarkerPosition
this doesn't seem to lead to the same sort of bug where the marker is off the chart.Added a story under test cases and test stories with rotations.