fix: position tooltip within chart with single value xScale#259
Conversation
Codecov Report
@@ Coverage Diff @@
## master #259 +/- ##
==========================================
+ Coverage 97.84% 98.26% +0.41%
==========================================
Files 36 36
Lines 2693 3170 +477
Branches 607 774 +167
==========================================
+ Hits 2635 3115 +480
+ Misses 51 44 -7
- Partials 7 11 +4
Continue to review full report at Codecov.
|
|
hey @emmacunningham just a suggestion, what if in the "single value" mode we switch between the "crosshair/vertical" mode and we manually enable the "follow" mode? |
nickofthyme
left a comment
There was a problem hiding this comment.
Tested locally, LGTM. Just two comments.
@markov00 yes, good idea. have implemented that logic here: 121a8fb |
## [8.0.1](v8.0.0...v8.0.1) (2019-07-15) ### Bug Fixes * position tooltip within chart with single value xScale ([#259](#259)) ([f458bc9](f458bc9))
|
🎉 This PR is included in version 8.0.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
## [8.0.1](elastic/elastic-charts@v8.0.0...v8.0.1) (2019-07-15) ### Bug Fixes * position tooltip within chart with single value xScale ([opensearch-project#259](elastic/elastic-charts#259)) ([6c6c2d7](elastic/elastic-charts@6c6c2d7))
Summary
fix #254
This PR introduces a fix for the tooltip positioning on a chart with a single value xScale.
I'm not entirely sure where the best place to position the tooltip, so this presents the minimal effort version, where the tooltip will be positioned inside of the chart aligned along the chart's edge (left if horizontal rotation, top if vertical rotation):
Implementation-wise, we've added a method
isSingleValueto theScaleclasses so that we can check if a scale is a single value scale (so that we can apply the different positioning in that case). ThecustomDomainknob was added to the stories to demonstrate that, when the chart only has one datapoint but has a multiple value scale, the tooltips are positioned as usual (since there is room to display them as normal).Checklist
Use
strikethroughsto remove checklist items you don't feel are applicable to this PR.- [ ] Any consumer-facing exports were added tosrc/index.ts(and stories only import from../srcexcept for test data & storybook)- [ ] Proper documentation or storybook story was added for features that require explanation or tutorials