Open zepplock opened 3 years ago
This is also similar but not exact issue: https://github.com/recharts/recharts/issues/1946
Hello, any update?
Hi @zepplock
The ability to add the onClick
property is a side effect of some interesting type extensions in the library.
Here are the props for XAxis. Because this extends SVGProps
...onClick
and many others get added to the types here.
Barring that you can access the original event with a different parameter because the events get adapted to add information to them/return different params
onClick={(xAxisInfo, index, originalEvent) => {
console.log(xAxisInfo, index, originalEvent);
}}
originalEvent
should be what you want as per these two functions
Labeling this as a typescript enhancement because currently the assumed type is incorrect as per the returned params in the onClick function
What problem does this feature solve?
Right now, there's no way to tell if click on XAxis (or any axis) had any modifiers (shift/ctrl/alt), whereas the full MouseEvent has
e.altKey
evailable. In fact this might be a bug since typscript definition specifies a fullReact.MouseEvent
foronClick
What does the proposed API look like?
This is not changing an API but rather pass a full
MouseEvent
vs a truncated one