-
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: mixing bars with line or area series breaks legend toggle #410
Conversation
Codecov Report
@@ Coverage Diff @@
## master #410 +/- ##
==========================================
+ Coverage 98% 98.12% +0.12%
==========================================
Files 39 39
Lines 2853 3037 +184
Branches 681 748 +67
==========================================
+ Hits 2796 2980 +184
Misses 50 50
Partials 7 7
Continue to review full report at Codecov.
|
I want to check on the
In the Mixed - bars and lines story, the bars are wider than the line series, so it seems to be adjusting correctly to account for space when the wider series isn't part of the chart. |
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.
LGTM (just a minor suggestion), since we are only hiding the bar series here, I think keeping a band type scale instead of switching to a continuous scale is the right approach in that situation and as shown in your gif it keeps the data representation the same, without rerendering the line only view to cover the full width.
It will be great if you can add a test for that, so we can catch any regression in the future
@@ -100,7 +99,7 @@ export function computeXScale(options: XScaleOptions): Scale { | |||
range: [start, end], | |||
}, | |||
{ | |||
bandwidth: bandwidth / totalBarsInCluster, | |||
bandwidth: totalBarsInCluster > 0 ? bandwidth / totalBarsInCluster : bandwidth / 1, |
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.
bandwidth: totalBarsInCluster > 0 ? bandwidth / totalBarsInCluster : bandwidth / 1, | |
bandwidth: totalBarsInCluster > 0 ? bandwidth / totalBarsInCluster : bandwidth, |
🎉 This PR is included in version 13.5.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
## [13.5.1](elastic/elastic-charts@v13.5.0...v13.5.1) (2019-10-09) ### Bug Fixes * mixing bars with line or area series breaks legend toggle ([opensearch-project#410](elastic/elastic-charts#410)) ([f53fcbd](elastic/elastic-charts@f53fcbd)), closes [opensearch-project#399](elastic/elastic-charts#399)
Summary
Fixes #399
The initial commit 4f2346e cast bandwidth in
scales.ts
infunction computeXScale
to 0 instead of the original issue where bandwidth was being divided by 0.Commit 209560a changed bandwidth to be
bandwidth/1
(instead of 0) which seems to be working as expected. My initial pass at this was to resolve the bug and get the x axis sizing appropriately based on the series that is visible. I plan to write or add to any unit tests but was hoping to get an initial first review to gather some feedback. Thanks!Checklist
Use
strikethroughsto remove checklist items you don't feel are applicable to this PR.src/index.ts
(and stories only import from../src
except for test data & storybook)- [ ] Proper documentation or storybook story was added for features that require explanation or tutorials