Skip to content

Releases: recharts/recharts

v3.8.0

06 Mar 21:47
a1044db

Choose a tag to compare

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

  • Pie: fix: enable tooltip synchronization for PieChart by @VIDHITTS in #6989
  • Pie: fix: sync pie tooltip/legend color with per-sector fill by @2YH02 in #6977
  • Bar: Fix activeBar highlighting with missing/null data by @Copilot in #7001
  • Bar: Support Bar CSS transitions by @PavelVanecek in #6920
  • XAxis/YAxis: respect user-provided textAnchor prop on XAxis/YAxis by @pierreeurope in #7028
  • Tooltip: Close tooltip on blur by @gVguy in #6958
  • General: fix error when onMouseEnter/Leave={undefined} by @SvetlanaVesna in #6969
  • Animation: [animations] auto disable primitives animations based on user system preferences by @cloud-walker in #6956
  • Animation/Line: fix: prevent animated line flicker with round/square strokeLinecap by @roy7 in #7022
  • Performance: filter zero-dimension rectangles early by @MendyLanda in #6800
  • Bump minimum @reduxjs/toolkit to 1.9.0 by @Copilot in #6934

Types

Docs

New Contributors

Full Changelog: v3.7.0...v3.8.0

v3.7.0

21 Jan 21:05
d1bc41c

Choose a tag to compare

What's Changed

📢 Cell is now deprecated and will be removed in the next major version. Please migrate all Cell usage to use the shape prop of respective chart elements. ‼️

Feat

New Hooks

Other

  • Tooltip: allow offset prop to accept Coordinate object by @bigsaigon333 in #6868
    X/YAxis add new axis type: "auto" by @PavelVanecek in #6823
    • sets the type to "category" for categorical axes, and "number" for numeric axis.
  • X/YAxis: replace tick: any with explicit type by @PavelVanecek in #6911
  • Bar/TypeScript: add BarShapeProps type to fix Bar.shape type by @PavelVanecek in #6900
  • TypeScript: add missing useful type exports for content, shape functions, etc. @PavelVanecek in #6852

Fix

  • BarChart: fix stackOffset=sign for charts with 3 or more positive values in one series by @PavelVanecek in #6807
  • BarStack: fix circular dependency when building with vite by @jkr2255 in #6777
  • BarStack: fix BarStack clipPath in charts with stackOffset=sign by @PavelVanecek in #6806
  • BarStack: apply bar stack radius to active bars by @PavelVanecek in #6906

Chore

Docs

We've started auto-generating our docs for the most part so you should see large improvements in accuracy of the docs between the code, the website, and the storybook. Huge shoutout to @PavelVanecek 🚀

New Contributors

Full Changelog: v3.6.0...v3.7.0

v3.6.0

15 Dec 06:43
71670d3

Choose a tag to compare

What's Changed

3.6 🚀 - check out BarStack and ranged stacked bars 📊

Feat

  • BarStack: new component BarStack by @PavelVanecek in #6746
    • allows configuring settings for the whole stack of bars such as radius
  • Bar: enable ranged stacked bars by @PavelVanecek in #6722
  • Pie/Typescript: Export PieSectorShapeProps type for shape function by @ramanverse in #6706
    XAxis/YAxis: Implement 'equidistantPreserveEnd' interval option for XAxis and YAxis (#6642) by @Om-Mishra09 in #6661
  • Tooltip: Add graphicalItemId to tooltip payload object by @PavelVanecek in #6765
  • TypeScript: Export TooltipIndex, BarRectangleItem, TreemapNode, DataKey, AxisInterval from public API by @Copilot in #6676

Fix

  • Scatter: fix bug where Tooltip payload data was duplicated or contained unrelated items when using multiple Scatter elements in one ScatterChart by @PavelVanecek in #6773
  • Label/LabelList: Fix crash when Label is passed as content to LabelList by @Harikrushn9118 in #6732
  • General: Round numbers before putting them to DOM by @PavelVanecek in #6707
  • General: Store refs instead of IDs to unblock shadow DOM usecases by @PavelVanecek in #6753

Chore

  • CartesianAxis: Deprecate CartesianAxis @PavelVanecek in #6774
  • Bump to Node 24
  • Lots of undefined checks for progress towards TS strict mode

Docs

  • Docs should be improving on the daily - comments in code + storybook + the website should all be coming closer to in sync thanks to @PavelVanecek pretty much writing his own documentation generator 🤖 🚀

New Contributors

Full Changelog: v3.5.1...v3.6.0

v3.5.1

28 Nov 06:32
9726f20

Choose a tag to compare

What's Changed

Fix

  • Pie: add missing Sector index to Pie shape prop by @ckifer in #6683
    • This enables customization of specific slices of the Pie similar to activeIndex in 2.x
  • Pie: prevent cross-Pie highlighting in multi-Pie PieCharts with shared dataKeys by @shreedharbhat98 in #6678
    • Only marks a specific Sector as active when that sector is hovered
  • TypeScript/Tooltip: update activeLabel type to be a string | number by @ckifer in #6691
    • !! NOTE !!: This change may break your types if you relied on it as a string, but this is a bug fix
  • Accessibility/General: add tabIndex -1 on Recharts ZIndex svg portal g tags to prevent extraneous focusable surfaces by @ckifer in #6687
  • General: Removed accidental eslint dependency from main dependencies which should remove it from installation with recharts

New Contributors

Full Changelog: v3.5.0...v3.5.1

v3.5.0

23 Nov 05:45
2bf10c9

Choose a tag to compare

What's Changed

Mostly fixes and performance improvements this release but check out the deprecation of Pie active/inactiveShape in favor of aligning with the shape prop of other chart elements.

Feat

  • Pie: add shape to align custom Pie sector shapes to other Recharts components by @ckifer in #6482
    • This change deprecates activeShape and inactiveShape. Please use the isActive prop passed from the callback to shape to create active Pie sectors.
    • Note: forgot to include the current Sector index, will add in 3.5.1
  • Stacked Charts: implement reverseStackOrder prop in v3 - fixes a regression between recharts 2 and 3 by @j-shimizu111 in #6644
  • Typescript/Dot: export ActiveDotProps and DotItemDotProps types by @simaks in #6657

Fix

Docs

New Contributors (thanks everyone!)

Full Changelog: v3.4.1...v3.4.2

v3.4.1

10 Nov 08:01
6d96b11

Choose a tag to compare

What's Changed

Forgot some exports for Z Index in 3.4

  • export DefaultZIndexes and ZIndexLayer by @ckifer in #6599

Full Changelog: v3.4.0...v3.4.1

v3.4.0

10 Nov 07:02
f07abc7

Choose a tag to compare

What's Changed

Added z-index support across most recharts surfaces + a few other features, lots of fixes, and some doc updates 🚀

Feat

  • Z Index! - You can now add a z index to many chart components to order the position of recharts elements as you wish, mimicking CSS z-index. Big shout out to @PavelVanecek in #6479
  • Line: add shape property to allow for custom shape implementations by @tarik02 in #6512
  • Stacked Bar: improved stacked bar animations
  • Sankey: support for left-aligned Sankey nodes via the align prop by @dbnl-renaud in #6568
  • Sankey: support for top-aligned Sankey nodes via the verticalAlign prop by @dbnl-kat #6576
  • Label: allow overwriting the textAnchor prop by @PavelVanecek in #6547

Fix

  • Stacked Bar / Brush: fix bug in stacked bar charts with a brush where the brush would remove elements from the wrong side of the chart by @37108 in #6481
  • Area: fix regression in Area event handlers where the events were not firing correctly by @PavelVanecek in #6507
  • Funnel: fix Funnel margin calculations by @PavelVanecek in #6453
  • Funnel: fix label position issues from previous release by @PavelVanecek in #6473
  • Label/Text: correct Label and Text types to only what they can actually render by @PavelVanecek in #6467
  • Misc: inline a few es-toolkit functions that were causing build errors by @daiboom in #6543
  • Misc: remove circular dependency import that had potential to cause runtime errors by @ckifer in #6581

Chore

  • Finished adding strict null checks and enabled strictNulls in TSConfig for good 🚀

Docs

Lots of changes in recharts.github.io

  • Switch code editor to codemirror by @PavelVanecek in #6531
  • Added/removed missing/stale properties where applicable from storybook and website
  • Few layout/visual changes and fixes on the website
  • Much more

New Contributors

Full Changelog: v3.3.0...v3.4.0

v3.3.0

17 Oct 05:54
7f4f707

Choose a tag to compare

What's Changed

Feat

  • ResponsiveContainer is now built-in to all charts by @PavelVanecek in #6388
    • add the responsive prop to any chart along with a height and width as if you were using ResponsiveContainer. One less component to wrap things with. ResponsiveContainer will continue to work for the life of 3.x
<BarChart data={data} responsive height={300} width="100%">
  ....
</BarChart>

Fix

  • YAxis: Only use the YAxis width="auto" oscillation detection if the difference is > 1 pixel by @PavelVanecek in #6450
  • ResponsiveContainer: only shrinks in the dimensions where it needs to shrink by @PavelVanecek in #6367
  • Treemap: fix animation stutters in Treemap by @PavelVanecek in #6326
  • Sankey: fix unique key error by @daiboom in #6352

Website changes - https://recharts.github.io/

Unfortunately the current contributors and admins do not own recharts.org and the renewal of the domain remains up in the air. To remove that uncertainty we have deployed the website at our github pages URL instead.

New Contributors

Full Changelog: v3.2.1...v3.3.0

v3.2.1

16 Sep 07:33
de8aa39

Choose a tag to compare

What's Changed

Fix

  • X/YAxis, etc.: reduce re-renders to fix blinking line in Zoom & Highlight example by @PavelVanecek in #6315
  • Bar: Remove redundant Rectangle import, fixes tsup builds with recharts in them by @guscost in #6305
  • Pie: fix PieLabel types by @PavelVanecek in #6313
  • Brush: fix index off by one error when margin is 0 by @ckifer in #6323
  • Enable dev tools via Global module instead of window by @uncaught in #6309

New Contributors

Full Changelog: v3.2.0...v3.2.1

v3.2.0

08 Sep 23:53
31b3c7f

Choose a tag to compare

What's Changed

Quite a bit of 3.0 bug fixes in this release along with two new hooks. Thanks to all who've been reporting issues!

Feat

Hooks

Fix

  • Bar: fix unnecessary line breaks in Bar labels by @eino in #6214
  • Bar: improve Bar performance when activeBar is turned off by @PavelVanecek in #6290
  • Stacked Bar/Area: fix stacked charts with duplicate categorical data by @PavelVanecek in #6194
  • Scatter: fix exception when Scatter data has non-string type property by @PavelVanecek in #6248
  • X/YAxis: fix blinking when changing props by @PavelVanecek in #6262
  • PolarAngleAxis/Radar: fix polar angle axis ticks text positions by @mindtraveller in #6276
  • Label: allow rendering Labels as nested children in XAxis, YAxis and Reference elements by @PavelVanecek in #6219
    LabelList: fix issue with LabelList not rendering in Pie charts by @PavelVanecek in #6246
  • Text: fix exception when Text's children is empty and scaleToFit=true by @PavelVanecek in #6282
  • Tooltip: bound Tooltip coordinates to the chart container in synchronized charts by @shreedharbhat98 in #6263
  • Brush: allow brush travelers to be controlled by keys after mouse interaction by @ckifer in #6285
  • useActiveTooltipDataPoints : fix infinite rendering loop by @PavelVanecek in #6247

Chore

New Contributors (thanks everyone!)

Full Changelog: v3.1.2...v3.1.3