-
Notifications
You must be signed in to change notification settings - Fork 727
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
new(xychart): add (EventEmitter, Tooltip)Context + basic Tooltips #825
Conversation
Pull Request Test Coverage Report for Build 50Details
💛 - Coveralls |
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 from the gif. just minor comments about naming. Wish we have preview build.
emitter.on<HandlerParams>(eventType, handler); | ||
return () => emitter?.off<HandlerParams>(eventType, handler); | ||
} | ||
return 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.
not necessary to return 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.
I get lint errors if I return nothing (not all paths return a value
) and undefined
was the only non-function return value allowed by TS
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.
oh right. ignore my comment then
packages/visx-xychart/src/utils/findNearestDatumSingleDimension.ts
Outdated
Show resolved
Hide resolved
55e440f
to
2b22494
Compare
* test(xychart): organize test/ into subfolders that mirror src/ * test(xychart): add EventEmitterProvider + TooltipProvider tests * test(xychart): add Tooltip test, add UseTooltipPortalOptions props * test(xychart): add useEventEmitter tests * test(xychart): add findNearestDatum tests * fix(xychart): test + type fixes
TODO
🚀 Enhancements
This PR adds event + tooltip layers to the
xychart
package, and updates the demo to use them. These layers were largely coupled in theXYChart
proof-of-concept (#745) but I think it's cleaner to separate the two so that different events (brush, pan, zoom) can be supported later.The event emitter context layer is implemented based loosely on the proof-of-concept discussed in #761 (see sandbox), and the tooltip context mostly mirrors the
useTooltip
functionality but provided in context instead of a hook.To explain how everything fits together I made this
Demo
Future work
@kristw @hshoff @techniq