useIsTooltipActive
Returns whether the tooltip is currently active (visible).true if the tooltip is active, false otherwise. Returns false if used outside a chart context.useActiveTooltipLabel
Returns the active tooltip label. The label is one of the values from the chart data, used to display in tooltip content.The active label, or
undefined if there is no active interaction or if used outside a chart context.useActiveTooltipDataPoints
Returns the currently active data points being displayed in the tooltip. This returns an array because a chart can have multiple graphical items (e.g., multiple Lines), and a tooltip withshared={true} will display all items at the same time.
The type of your data points. Defaults to
unknown.Array of data points currently visible in the tooltip, or
undefined if there is no active interaction or if used outside a chart context.useActiveTooltipCoordinate
Returns the Cartesian x + y coordinates of the active tooltip.Object with
x and y pixel coordinates, or undefined if there is no active interaction or if used outside a chart context.Coordinate type
Usage notes
- All tooltip hooks return
undefinedwhen used outside a chart context - Recharts only allows one Tooltip per chart, so these hooks do not take any parameters
- These hooks follow the
<Tooltip />props if the Tooltip element is present in the chart