Replies: 3 comments
-
Hi, this is done and will be released in 3.0! |
Beta Was this translation helpful? Give feedback.
0 replies
-
Also see #2458 |
Beta Was this translation helpful? Give feedback.
0 replies
-
Thanks for the quick response! Found the exact PR - #4441, So, Closing this discussion! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
TL;DR: Can we check for the ability to "Portal" out the Tooltips, so that it won't be cut off when using charts inside scrollable containers?
Use Case
First, I have built quite a lot of charts using this awesome library, so thank you so much for building and maintaining this project. ❤️
In one of our designs, we have a Bar chart that is placed inside a scrollable container. We are using Custom tooltips to show additional information for each bar. The problem we faced is the tooltip displayed gets cut out at the very end of the scrollable containers.
Demo
To overcome this, I am using portal to move the tooltip outside the chart container. In order to place the tooltip next to the cursor, I am checking for the position of
.recharts-tooltip-wrapper
and copying that to the portal container. Finally, I am usingcoordinate
fromCustomTooltip
and making it absolutely positioned to achieve the same effect. Please refer to the demo and the code below.Full repository for the above is here - https://github.com/payapula/recharts_tooltip/tree/main
Below is the code that does this logic
I understand that, this is not the ideal solution to overcome this issue, and we are hacking into the internal class of recharts and syncing its position with our portal container 😅
The main reason for this is, the
coordinate
we get inside theCustomTooltip
is relative to the.recharts-tooltip-wrapper
.Proposal
I wanted to get your ideas and suggestions on providing a portal target prop for tooltips, so that tooltips will be always visible even when the chart is inside scrollable container.
✨ An Example: Adding a
portal
prop that will take ref to the container element?One of the challenge I think will be to properly provide the
x
andy
coordinate
s for the tooltip based on the portalRef.Let me know your thoughts.!
Thanks Again ❤️
Beta Was this translation helpful? Give feedback.
All reactions