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
how can I pin a tooltip in a chart #4387
Comments
This is currently only partially possible. Click and stick is easy enough using the "active" and "defaultIndex" props, but it is impossible to have more than one instance of Tooltip show at once at this point. |
@ckifer |
sure, but this doesn't work at the moment because recharts prevents multiple instances of Tooltip. You might be able to get it to work with a custom Tooltip component where you remember the clicked Tooltip's position and always render it there if its set. Otherwise, you render the hovered position as normal. |
@ckifer I already realized that this cannot be done using reacharts native means. Thank you for the quick feedback) |
Yep agreed. Just trying to give ideas to unblock. Labelled as an enhancement and something we'll need to add in the future. If someone wants to contribute feel free. |
This does work to "lock" the tooltip though, it just won't show a second instance when hovering |
I suspect it would be difficult or impossible to get the manually-rendered "tooltips" to stay in the correct location if the chart is resized, but I can probably live with that. But I'd much prefer a native solution to this. Update: |
In 3.x we will allow multiple Tooltip instances so that should help.
…On Wed, Apr 17, 2024, 05:56 Nico Greenarry ***@***.***> wrote:
This feature is important to me as well. Right now I'm considering a
non-native workaround, like when the user pins a point, record the
coordinates and use non-Recharts code to render a fake tooltip there.
I suspect it would be difficult or impossible to get the manually-rendered
"tooltips" to stay in the correct location if the chart is resized, but I
can probably live with that.
But I'd *much* prefer a native solution to this.
—
Reply to this email directly, view it on GitHub
<#4387 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAIMTCUIB5QWRYTJ4QDRXULY5WGBTAVCNFSM6AAAAABFXEBIMSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANJZHEYDSOJUHE>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
I need to be able to click on the stick and the tooltip stops moving and is fixed to its coordinates, and when the cursor moves, other tooltips are shown to me. When you click on the same coordinates to which the tooltip is currently attached, it should unpin.
The text was updated successfully, but these errors were encountered: