Skip to content

recharts 3.8.0

What's Changed

We added generics to our data and dataKey props and now you can have your charts validated by TypeScript. See the full guide here: https://recharts.github.io/en-US/guide/typescript/

We are releasing new helper functions and hooks that will allow you to precisely target mouse interactions, and convert coordinates. See the guide here: https://recharts.github.io/en-US/guide/coordinateSystems/

And new functions and hooks:

getRelativeCoordinate - converts mouse events to pixel positions

Convert Data → Pixels:

useXAxisScale - returns a function to convert X data values to pixel positions useYAxisScale - returns a function to convert Y data values to pixel positions useCartesianScale - convenience hook for converting both at once

Pixels → Data:

useXAxisInverseScale - returns a function to convert pixel X to the closest data value useYAxisInverseScale - returns a function to convert pixel Y to the closest data value useXAxisInverseTickSnapScale - returns a function to convert pixel X to the closest axis tick useYAxisInverseTickSnapScale - returns a function to convert pixel Y to the closest axis tick

Accessing Ticks:

useXAxisTicks - returns the calculated ticks of an X-axis useYAxisTicks - returns the calculated ticks of a Y-axis

Feat

Fix

Types

Docs

New Contributors

Full Changelog: https://github.com/recharts/recharts/compare/v3.7.0...v3.8.0