-
Notifications
You must be signed in to change notification settings - Fork 122
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: show tooltip for external events #698
feat: show tooltip for external events #698
Conversation
b40c1b2
to
fd6b7df
Compare
Codecov Report
@@ Coverage Diff @@
## master #698 +/- ##
==========================================
+ Coverage 74.80% 75.16% +0.35%
==========================================
Files 265 282 +17
Lines 8541 8877 +336
Branches 1714 1675 -39
==========================================
+ Hits 6389 6672 +283
- Misses 2099 2146 +47
- Partials 53 59 +6
Continue to review full report at Codecov.
|
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.
Looking good. Have you noticed the performance lag on the Cursor Update Action
story?
Yes the performance lag happen only when you have the |
I noticed that when hovering on the upper chart, the tooltip below is placed over the highlighted region. In this case I would expect the tooltip on the lower chart to be place at either of the two blue boxes. Wouldn't you agree? What's strange is that the opposite is not the same. When hovering on the lower chart, the upper chart displays the tooltip in the expected position. |
On another note, the vertical placement of the "following" tooltip seems clunky. It just sticks to the top. I think it may be too much to handle in this pr but a future enhancement could be to match the relative (i.e. percentage or ratio of) height from the "active" tooltip. So if the "active" tooltip is in the middle 50% height, then the "following" would be placed at 50% of its chart height. I think this would look a lot better. |
@nickofthyme this is because we are using the |
@markov00 Oh that makes sense because the anchor element is just a strip across the highlighted region. Another thing I noticed is the Also, small possibly related issue. I notice an empty tooltip when the "following" tooltip is on the ends of the chart. See black dot show with blue arrows. |
Whit this commit I'm fixing the fact that: the TooltipType used for external events is only the VerticalCursor (no follow, no Crosshair). I've also fixed the rendering of the cursor band if the tooltip type of a chart is defined as None, showing always the cursor band if the events comes from an external event. The tooltip disappearing bug was also fixed b25e01f |
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.
Changes look good to me. Small black circle tooltip issue is gone.
Only change I would suggest is to add a knob to change the tooltip type for the "active" chart to see that the "following" tooltip will always be vertical or none.
width: 0; | ||
height: 0; |
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.
👍
@@ -185,11 +180,11 @@ const TooltipPortalComponent = ({ anchor, scope, settings, children, visible, ch | |||
}, [visible, anchorNode, position?.left, position?.top, position?.width, position?.height]); | |||
|
|||
useEffect(() => { |
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 Love love love this, I don't know why I made this so overly complicated. I swear I tried this but couldn’t get it to work right. Maybe I was trying to prevent recreating the portal node every time it's hidden.
I also like that the portal now disappears every time.
🎉 This PR is included in version 19.6.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
# [19.6.0](elastic/elastic-charts@v19.5.2...v19.6.0) (2020-06-24) ### Features * show tooltip for external events ([opensearch-project#698](elastic/elastic-charts#698)) ([d18953a](elastic/elastic-charts@d18953a)), closes [opensearch-project#695](elastic/elastic-charts#695)
Summary
Adds the ability to show tooltip on a synced chart.
The
<Settings />
component has a new prop that allows the consumer to describe the behavior of external events (in this case the behavior of the tooltip if an external event was received from the chart).The main settings is the ability to turn on the tooltip visibility if an external pointer event is received. Then the consumer can also configure the placement of the tooltip and the boundary, as it can be done for a normal tooltip.
The
ExternalPointerEventsSettings
is structured like that to accommodate in the future more settings, not only for tooltip but for anything that can be configured in case of external events (like change/update the legend extra value when we receive an event from another chart).close #695
Checklist
Delete any items that are not applicable to this PR.
src/index.ts
(and stories only import from../src
except for test data & storybook)