-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Add mouse events to line slices #2128
Conversation
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit add2bf3:
|
@plouc Can we get this merged, we need mouse event feature for line slices at Usermaven.com |
This would be very helpful |
Oh yes please! I need this as well. |
Adding on to say this change would be amazing to have merged in! |
Nice work! We need this feature as well. |
I think this is also related: #2187 |
Bump |
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, however I think this should be added to the docs, but this can be done in a separate PR, as adding doc is currently undocumented 😅.
@sigmike @plouc I noticed this passes the slice to the handler while normally they'd receive a point, was this on purpose? It's particularly confusing with TypeScript. While I'm aware the line chart still lacks full TS support I see two possible improvements here:
export type PointMouseHandler = (point: Point, slice: null, event: React.MouseEvent) => void
export type SliceMouseHandler = (point: null, slice: Slice, event: React.MouseEvent) => void
export interface LineProps {
// ...
onMouseEnter?: PointMouseHandler | SliceMouseHandler
// ...
}
|
Is there any fix in version v.0.80.0? I am unable to upgrade due to the following issue: #2310 |
On the Line chart the mouse events (
onMouseEnter
,onMouseMove
,onMouseLeave
andonClick
) work fine when the mesh is enabled but not when the slices are enabled. This PR fixes that.Related issue: #1401.