Feature Request - Programatically show/hide tooltip
See original GitHub issueDo you want to request a feature or report a bug?
Feature.
What is the current behavior?
The available callbacks for a chart (e.g. LineChart
), are:
For tooltips to appear, the user hovers on the chart component with it’s child <Tooltip>
component and internal callbacks are fired to set the <Tooltip>
prop to active and provide it with props for the payload
, which it uses to style and display the hover tooltip.
To my knowledge, this is the only way to make tooltips appear, via user interaction with the chart.
If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem via https://jsfiddle.net or similar (template: http://jsfiddle.net/ndLhnegs/).
What is the expected behavior?
As this is a feature request, I will express the desired behaviour.
I would like a way to programatically display the tooltip on my chart.
E.g. triggered via a callback on another parent component of the <Chart>
component), where I provide dataset key I want the tooltip to display information for.
For example, if we look at the SimpleLineChart - http://recharts.org/#/en-US/examples/SimpleLineChart
I would like to be able to call something like showTooltip('Page D')
, on the <LineChart>
to programatically make my tooltip appear.
The ‘why’ factor
This way, if I have other components showing relevant contextual info relating to Page D
on another component, when the user interacts/hovers on THAT component, I can fire this new callback to show the tooltip on the chart at the same time, providing a better user experience.
It need not get in the way of lifecycle events as user’s mouse interaction with the chart can still go through it’s normal events and ultimately be hidden once the user’s mouse leaves the chart again.
In summary, I would like to request API methods on the charts for:
showTooltip()
hideTooltip()
Which versions of Recharts, and which browser / OS are affected by this issue? Did this work in previous versions of Recharts?
latest
Issue Analytics
- State:
- Created 5 years ago
- Reactions:67
- Comments:10 (1 by maintainers)
Top GitHub Comments
I face with this issue too. I want to show the tooltip if item is focused. This is necessary for better accessibility. But there is no feature to programmatically show and hide the tooltip.
I need this too!😢