Skip to content

Releases: recharts/recharts

v3.10.0

Choose a tag to compare

@PavelVanecek PavelVanecek released this 20 Jul 20:30

What's Changed

Legend position

Legend now supports position and offset props, same as Label and LabeList. This replaces the previous align and verticalAlign for a more convenient positioning, and fixes couple visual bugs too. See https://recharts.github.io/en-US/examples/LegendPosition/

XAxis auto height

XAxis now supports height="auto" prop, similar to YAxis width="auto".

  • feat(XAxis): support height="auto" to size the axis to its tick labels by @kimlj in #7570

Other features

  • feat(Sankey): support accessibilityLayer, title and desc props by @MahinAnowar in #7546

Bugfixes

  • fix: clear stale active bar layer state by @pupuking723 in #7547
  • fix(Brush): slide snaps back to original position on mouseup when start/endIndex are controlled by @MaksZhukov in #7542
  • fix(Tooltip): find the active sector in the angle-axis wrap-around gap by @MahinAnowar in #7550
  • fix(Brush): keep controlled startIndex/endIndex on data updates by @momomuchu in #7530
  • Fix Legend type by @PavelVanecek in #7560
  • fix(Label): pass computed position attributes to custom label content by @MahinAnowar in #7549
  • fix(CartesianAxis): skip renderedTicks dispatch when tick values are unchanged by @kimlj in #7565
  • fix: prevent getBandSizeOfAxis from collapsing band size due to floating-point tick gaps by @xianjianlf2 in #7556
  • fix(Area): connectNulls connects across stacked points where every series is null by @kimlj in #7566

New Contributors

Full Changelog: v3.9.2...v3.10.0

v3.9.2

Choose a tag to compare

@PavelVanecek PavelVanecek released this 04 Jul 03:06

What's Changed

  • docs: clarify custom labels and ticks need SVG elements by @ishaanlabs-gg in #7524
  • chore(deps): bump immer from 11.1.8 to 11.1.9 by @dependabot[bot] in #7526
  • fix(Sankey): avoid exponential depth traversal on dense graphs by @dm-gthb in #7479

New Contributors

Full Changelog: v3.9.1...v3.9.2

v3.9.1

Choose a tag to compare

@PavelVanecek PavelVanecek released this 30 Jun 11:19

What's Changed

  • perf: optimize ScatterChart hover by reducing re-renders from O(n) to O(1) by @roy7 in #7133
  • fix(YAxis): render explicit ticks when a non-literal domain can't resolve on empty data (#7362) by @nlenepveu in #7393
  • fix: avoid Sankey nodes overlapping skipped-depth links by @pupuking723 in #7471
  • Add stacked bar chart with horizontal threshold line example by @nijuse in #7495
  • fix(DefaultLegendContent): omit empty value from legend icon aria-label by @greymoth-jp in #7501
  • chore(deps): bump immer from 10.2.0 to 11.1.8 by @dependabot[bot] in #7452
  • fix(getNiceTickValues): remove trailing duplicate tick when allowDecimals=false by @JSap0914 in #7482
  • Fix/per graphical item formatter prop by @shreedharbhat98 in #7287

New Contributors

Full Changelog: v3.9.0...v3.9.1

v3.9.0

Choose a tag to compare

@PavelVanecek PavelVanecek released this 23 Jun 13:18
8c1cce7

What's Changed

Animations

3.9 comes with new animations! There are several bug fixes and what's best, all animations are now fully customizable.

See the animations guide on https://recharts.github.io/en-US/guide/animations/

New features other than animations

  • Expose and document chart layout hooks and layout types in public API by @Copilot in #7265
  • feat: allow HTML attributes passthrough on ResponsiveContainer by @techcodie in #7168
  • feat: add nodeInset and nodeGap properties to Treemap for better la… by @MaximSrour in #7044
  • feat(PieChart): add dataKey to Legend payload by @Harikrushn9118 in #7137

Bugfixes

  • fix: preserve valid falsy custom names (0, "") in tooltips by @vamsi2246 in #7175
  • fix(ResponsiveContainer): Fix erroneous console warning on init by @andypoorman in #7174
  • fix(DataUtils): improve isPercent validation to exclude invalid formats by @vamsi2246 in #7178
  • fix(BarChart): render stacked bars when all values are 0 (#6235) by @andypoorman in #7199
  • fix(Sankey): prevent NaN node positions when link values sum to zero by @Mridul012 in #7185
  • fix(Funnel): prevent NaN coordinate layout crash when all values are zero by @Mridul012 in #7184
  • fixes an issue where XAxis and YAxis padding were ignored by the clipping mask when allowDataOverflow={true} was used alongside a restricted domain by @emiedonmokumo in #7232
  • fix: use originalDataIndex for tooltip dispatch in Bar by @mayrang in #7273
  • fix: resolve TypeScript 6 deprecation errors in tsconfig files by @shreedharbhat98 in #7285
  • fix(bar): use Math.round instead of bitwise truncation for bar positioning by @EduardF1 in #7297
  • fix(types): propagate Tooltip types in chart helper contexts by @mixelburg in #7125
  • fix(Legend): prevent overlap with chart on container resize by @maroKanatani in #7201
  • test(YAxis): failing repro for #7362 β€” function domain doesn't render ticks on empty/all-null data by @nlenepveu in #7384

Tree-shaking

We now have focused tree-shaking tests that allow us to observe exactly which components end up in the final bundle and why. I have also removed some unnecessary loops and you should see the final bundle size decrease somewhat as a result.

There are also two new examples on the website, showing real bundle size:

Documentation updates

New Contributors

Full Changelog: v3.8.1...v3.9.0-canary.0

v3.9.0-canary.0

v3.9.0-canary.0 Pre-release
Pre-release

Choose a tag to compare

@PavelVanecek PavelVanecek released this 07 Jun 01:54

What's Changed

This is a canary release, meaning that the new features announced in this release may change. While I am happy with the new props, I would like to gather some feedback before going stable.

Animations

3.9 comes with new animations! There are several bug fixes and what's best, all animations are now fully customizable.

I'm releasing a canary version first; please try it out, if there are some problems then please let me know so I can fix things before we release a stable version.

See the animations guide on https://recharts.github.io/recharts/canary/www/en-US/guide/animations/. Try to integrate it with your charts, write custom animations, let me know how it went!

New features

  • Expose and document chart layout hooks and layout types in public API by @Copilot in #7265
  • feat: allow HTML attributes passthrough on ResponsiveContainer by @techcodie in #7168
  • feat: add nodeInset and nodeGap properties to Treemap for better la… by @MaximSrour in #7044
  • feat(PieChart): add dataKey to Legend payload by @Harikrushn9118 in #7137

Bugfixes

  • fix: preserve valid falsy custom names (0, "") in tooltips by @vamsi2246 in #7175
  • fix(ResponsiveContainer): Fix erroneous console warning on init by @andypoorman in #7174
  • fix(DataUtils): improve isPercent validation to exclude invalid formats by @vamsi2246 in #7178
  • fix(BarChart): render stacked bars when all values are 0 (#6235) by @andypoorman in #7199
  • fix(Sankey): prevent NaN node positions when link values sum to zero by @Mridul012 in #7185
  • fix(Funnel): prevent NaN coordinate layout crash when all values are zero by @Mridul012 in #7184
  • fixes an issue where XAxis and YAxis padding were ignored by the clipping mask when allowDataOverflow={true} was used alongside a restricted domain by @emiedonmokumo in #7232
  • fix: use originalDataIndex for tooltip dispatch in Bar by @mayrang in #7273
  • fix: resolve TypeScript 6 deprecation errors in tsconfig files by @shreedharbhat98 in #7285
  • fix(bar): use Math.round instead of bitwise truncation for bar positioning by @EduardF1 in #7297
  • fix(types): propagate Tooltip types in chart helper contexts by @mixelburg in #7125
  • fix(Legend): prevent overlap with chart on container resize by @maroKanatani in #7201
  • test(YAxis): failing repro for #7362 β€” function domain doesn't render ticks on empty/all-null data by @nlenepveu in #7384

Tree-shaking

We now have focused tree-shaking tests that allow us to observe exactly which components end up in the final bundle and why. I have also removed some unnecessary loops and you should see the final bundle size decrease somewhat as a result.

There are also two new examples on the website, showing real bundle size:

Documentation updates

New Contributors

Full Changelog: v3.8.1...v3.9.0-canary.0

v3.8.1

Choose a tag to compare

@PavelVanecek PavelVanecek released this 25 Mar 11:11
5b10788

What's Changed

Bugfixes!

  • fix(z-index): prevent elements from disappearing during dynamic zIndex transitions by @VIDHITTS in #7006
  • fix: prevent tooltip flicker in syncMethod="value" with mismatched data arrays by @roy7 in #7020
  • docs: add missing SVG props documentation to PolarGrid #3400 by @ramanverse in #6987
  • fix: add cursor prop type to BaseChartProps by @mixelburg in #7065
  • fix: restore arrow key navigation when active index is outside zoomed… by @AbishekRaj2007 in #7086
  • Add test for ticks spacing by @VIDHITTS in #7082
  • fix(Pie): skip minAngle redistribution when no segment needs it by @Harikrushn9118 in #7097
  • fix(DefaultLegendContent): use entry.value for aria-label when formatter returns React element by @mixelburg in #7109
  • fix(PolarRadiusAxis): update ticks prop type by @PavelVanecek in #7112
  • fix: PieChart double padding gap when a data item has value 0 by @Copilot in #7113
  • Add boxplot example by @PavelVanecek in #7130
  • [fix] Update ticks calculator and domain extension by @PavelVanecek in #7146
  • fix: guard against non-function d3-scale exports in getD3ScaleFromType by @tdebarochez in #7123
  • fix: stackOffset expand should not override numerical XAxis domain by @SeaL773 in #7152
  • fix: resolve keyboard navigation and tooltip issues for Pie charts (#6921) by @olagokemills in #7140
  • fix(Tooltip): prevent crash on sparse or undefined payload entries by @Om-Mishra09 in #7149
  • fix(RechartsWrapper): prevent ResizeObserver memory leak on ref update by @Om-Mishra09 in #7161

New Contributors

Full Changelog: v3.8.0...v3.8.1

v3.8.0

Choose a tag to compare

@PavelVanecek PavelVanecek released this 06 Mar 21:47
a1044db

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

Choose a tag to compare

@ckifer ckifer released this 21 Jan 21:05
d1bc41c

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 πŸš€

  • Dark mode πŸ•ΆοΈ by @cloud-walker in #6828
  • Recharts devtools has been added to all website examples for easier issue debugging

New Contributors

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

v3.6.0

Choose a tag to compare

@ckifer ckifer released this 15 Dec 06:43
71670d3

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

Choose a tag to compare

@ckifer ckifer released this 28 Nov 06:32
9726f20

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