Recharts provides a set of React hooks that allow you to access chart data, scales, and state from within custom components. All hooks must be used within a chart context (inside aDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/recharts/recharts/llms.txt
Use this file to discover all available pages before exploring further.
LineChart, BarChart, etc.). Using them outside a chart will return undefined.
Hook categories
Tooltip hooks
Access tooltip state and active data points.useIsTooltipActive- Check if tooltip is currently visibleuseActiveTooltipLabel- Get the active labeluseActiveTooltipDataPoints- Get active data pointsuseActiveTooltipCoordinate- Get tooltip coordinates
Axis hooks
Access axis properties, domains, and ticks.useXAxis/useYAxis- Get axis configurationuseXAxisDomain/useYAxisDomain- Get axis domainuseXAxisTicks/useYAxisTicks- Get axis ticks
Scale hooks
Convert between data values and pixel coordinates.useXAxisScale/useYAxisScale- Convert data to pixelsuseXAxisInverseScale/useYAxisInverseScale- Convert pixels to datauseCartesianScale- Convert data points to pixel coordinates
Chart layout hooks
Access chart dimensions and layout information.useOffset
Returns the offset of the chart in pixels. The offset defines the blank space between the chart and the plot area, occupied by axes, legends, and brushes. Returns:ChartOffset | undefined
usePlotArea
Returns the plot area where chart data is rendered (bars, lines, scatter points, etc.). Returns:PlotArea | undefined