npm recharts 3.11.0
v3.11.0

2 hours ago

What's Changed

New feature: Themes!

Write one theme, store it in a context and all charts in the React tree will inherit the same look. Read more in https://recharts.github.io/en-US/guide/theming/

For better accessibility, patterns are now available for use too, see https://recharts.github.io/en-US/guide/patterns/ as well as label colors, background, and halo: https://recharts.github.io/en-US/guide/label-colors/

More features

Performance improvements

Bugfixes

  • fix(Pie): make maxRadius actually constrain percentage-based radii by @pratik-desgn in #7594
  • fix(Pie): interpolate paddingAngle during animation by @pratik-desgn in #7593
  • Added effect in cartesian YAxis to update width to initial size on data change by @Elaskin in #7347
  • fix: infinite loop in reduceCSSCalc when a value contains $& by @jcross in #7610
  • fix(Brush): honor a selection of the first data point only by @kdelay in #7618
  • fix(Sankey): skip links that point back along the current path by @jcross in #7619
  • fix(BarStack): expand clip path so bar strokes are not clipped by @ostapondo in #7606
  • fix: guard reduceCSSCalc against ReDoS from pathological calc() input by @bunlongheng in #7620
  • fix(axis): stop a two-tick axis whose domain crosses zero from overflowing the stack by @Jaybhade in #7622
  • fix(Bar): stop stacked minPointSize inflation from overlapping neighboring segments by @pratik-desgn in #7600
  • fix(Rectangle): keep the rectangle mounted while it animates to zero by @adarshsm in #7596
  • fix(types): export prop interfaces referenced by public component props by @MahinAnowar in #7642
  • Stop hasDuplicate reporting Object.prototype keys as duplicates by @MahinAnowar in #7655
  • fix(useElementOffset): prevent measurement feedback loops by @yoan-md in #7671
  • fix(Treemap): give nest breadcrumbs a stable key by @MahinAnowar in #7669
  • fix(XAxis): equidistantPreserveEnd renders a single tick when the end label overflows by @ChristianK43 in #7697
  • fix(util): keep LRUCache within maxSize and refresh recency for undefined values by @MahinAnowar in #7715
  • fix: declare @types/react as an optional peer dependency by @tifandotme in #7710
  • fix(radar): keep radar points on their angle axis ticks when the angle range ascends by @giaBaoJS in #7708
  • fix(PolarGrid): drop the duplicate radial line where the angle axis wraps around by @giaBaoJS in #7727
  • fix(z-index): drop tabIndex from z-index portal groups to stop pointer focus rings by @devtechedge in #7805
  • fix(Radar): render polar cursor during keyboard navigation by @greglum in #7813
  • fix(Line): fall back to the themed fill when the line stroke is none by @kdelay in #7833
  • fix(Sector): shrink rounded corners to fit narrow sectors by @gagan-baghel in #7868
  • fix(Tooltip): cancel pending throttled mousemove on mouseleave by @fushanbobfan in #7884
  • fix: avoid call stack overflow in the domain of large stacked series by @sarmah-rup in #7878
  • fix(BarStack): normalize a lone rectangle so single negative bars round at the outer end by @charan-rathore in #7896
  • fix(Brush): keep the start and end index inside the data by @charan-rathore in #7916
  • fix: stop rendering the text undefined in Bar, RadialBar and Brush attributes by @charan-rathore in #7914
  • fix(animation): map ease-out and ease-in-out to the correct CSS bezie… by @charan-rathore in #7931
  • fix(dataKey): honor defaults for undefined function results by @MokiMeow in #7942
  • fix(Funnel): render activeShape for Tooltip defaultIndex by @PavelVanecek in #7947
  • fix(sync): align synchronised tooltip cursor with the receiving chart's ticks by @PavelVanecek in #7960
  • fix(Tooltip): render RadialBar cursor for defaultIndex (#7672) by @ErfanBagheri404 in #7690
  • fix(Pie): do not allocate minAngle or padding to null values by @maxymlyskov in #7967
  • fix(Funnel): per-entry tooltip colors and Legend payload (#7975) by @charan-rathore in #7985
  • fix(scatter): per-point tooltip colors, stop entry id leaking to symbols (#7976) by @charan-rathore in #7986
  • fix(RadialBar): do not draw a full-circle bar for a null value by @maxymlyskov in #7971
  • fix(Tooltip): keep touch tooltips working after a throttled touch misses an item by @maxymlyskov in #7994
  • fix(Treemap): explicit colors turn off the theme, and node rectangles no longer get ids by @fushanbobfan in #7995
  • fix(Line): break vertical lines at null values like horizontal ones by @maxymlyskov in #7997
  • fix(XAxis): move the first equidistantPreserveStart label inwards by @giaBaoJS in #7729
  • fix: render backgrounds for labels on text paths by @sviat-barbutsa in #8011
  • fix(Radar): leave a gap at null values instead of drawing them at the center by @maxymlyskov in #8010
  • fix(Bar): pass the original data index to sparse bar mouse events by @charan-rathore in #7929
  • fix(Bar): tooltip shows the color the bar renders with, entry id and styles stay off the background by @kaanisthatyou in #8000
  • fix(ErrorBar): treat numeric strings in the data as numbers by @maxymlyskov in #8013
  • fix(ReferenceArea): skip the area when an edge is not on the axis by @maxymlyskov in #8017
  • fix(SunburstChart): apply data entry styles by @itisrmk in #8019
  • fix: guard portal setState against React 19 Suspense disappearLayoutEffects by @mixelburg in #7474
  • fix(accessibility): consume arrow/enter key defaults so Safari stops scrolling the page by @Kumar44developer in #8049
  • fix(SunburstChart): end the chart at endAngle when startAngle is not 0 by @nk-batman21 in #8060
  • fix(ReferenceDot): don't render at the origin when a coordinate isn't on its axis by @itisrmk in #8052
  • fix(Sankey): apply data entry styles to nodes and links without a theme by @abdull-ah-med in #8022
  • fix(LabelList): skip labels of elements outside the clipped domain by @b84330808 in #8051
  • fix(Tooltip): drop the activeIndex fallback for an unmatched axis label by @jayzhou2309 in #7907
  • fix(Tooltip): keep the position while custom content renders nothing by @mkantautas in #8062
  • fix: paint Line, Area and Radar data points with their own fill and stroke by @mrityunjay-pandey in #7969
  • fix(Bar): render a single bar on a numeric axis without barSize by @anzal1 in #7943
  • fix(Pie): do not pad the first sector after leading zero values by @nk-batman21 in #8067
  • fix(Sunburst): identify sectors by tooltip index instead of node name by @Kumar44developer in #8033
  • fix(ErrorBar): clip error bars with their graphical item by @b84330808 in #8054
  • fix(Bar): keep rectangle keys stable while the bars animate by @MFA-G in #8065
  • fix(Treemap): show the hovered node's color in the tooltip by @itisrmk in #8048
  • Fix Text maxLines crash with empty content by @landfvit in #8101
  • fix(RadialBar): use a custom background element or function by @nk-batman21 in #8113
  • fix(Text): preserve Unicode code points when wrapping with breakAll by @charan-rathore in #8117
  • fix(CartesianGrid): align grid lines with tick labels when custom fon… by @Medyooo in #7719
  • fix(Scatter): keep a z value of 0 for bubble size and tooltip by @maxymlyskov in #8026
  • fix(Tooltip): hide synchronised tooltips when the source chart unmounts by @maxymlyskov in #8135
  • fix(Label): center a position="center" Label on its Pie by @nk-batman21 in #8139
  • fix(stackOffset): keep the domain of an axis with no stacked items by @maxymlyskov in #8028
  • fix(Line): keep repeated categories with nested, function, or 0 axis dataKey by @jayzhou2309 in #7921
  • fix(ErrorBar): extend the axis domain for error bars on stacked items by @maxymlyskov in #8141
  • fix(XAxis): recover height="auto" after starting with empty data by @nk-batman21 in #8144
  • fix(Text): preserve grapheme boundaries when wrapping and truncating by @charan-rathore in #8133
  • fix(Text): retain the final fitting truncation prefix by @charan-rathore in #8153
  • fix(ChartUtils): draw each row on the tick of its own category by @maxymlyskov in #8150
  • fix(PolarAngleAxis): put the first category on startAngle when the angle range ascends by @jayzhou2309 in #7932
  • fix(polar): include stack totals in the stacked RadialBar domain by @roux-lon in #8160
  • fix(LabelList): keep the data index for Bar labels after skipped bars by @kunalx731 in #8158

Documentation

  • docs: fix dead React link in README by @aliabbas-muhammadi in #7648
  • docs: fix dead UMD install links in README by @aliabbas-muhammadi in #7653
  • Render source code in SSG so that agents can read it straight from the HTML by @PavelVanecek in #7652
  • docs(polygon): add description for Polygon component by @Medyooo in #7667
  • docs(brush): add descriptions for Brush props by @Medyooo in #7675
  • Remove styling props from website examples and rely on theme alone by @PavelVanecek in #7679
  • Require either @SInCE or @experimental annotations on all new exports by @PavelVanecek in #7686
  • docs(sector): add description for Sector component by @Medyooo in #7693
  • docs: add locale formatting examples to tickFormatter and Tooltip for… by @Medyooo in #7692
  • fix(omnidoc): strip LinkToApi and resolve correct story name in generated Storybook MDX by @SanyaGubrani in #7712
  • docs(PolarGrid): add missing description for radialLines prop by @Chandu-Putta in #7728
  • refactor(test-vr): migrate VR tests to the Playwright story gallery by @visheshgubrani in #7714
  • Add interactive visual regression gallery by @PavelVanecek in #7734
  • Deploy VR gallery to GitHub Pages by @PavelVanecek in #7735
  • docs(XAxis): add a website example for height="auto" by @kimlj in #7798
  • docs: document the function form of syncMethod with a different-data example by @roy7 in #7830
  • docs(polar): describe the zIndex prop on Pie, Radar and RadialBar by @Tinnnnnnnnk in #7865
  • fix(www): preserve color mode in StackBlitz exports by @minwookshin in #7908
  • docs: clarify reference element label object props by @valkiara in #7919
  • fix(omnidoc): drop links to symbols without an API page by @PavelVanecek in #7962
  • docs(www): use autoTheme in StackBlitz examples by @PavelVanecek in #8088
  • docs(www): StackBlitz preview follows the editor theme by @PavelVanecek in #8090
  • docs(www): add Nightingale chart example by @Xerox563 in #8095
  • docs(www): add multi-series wind rose example by @Xerox563 in #8118
  • docs(omnidoc): mark public API exports with @public and enforce it by @ak-grg in #8132
  • docs(XAxis): explain that allowDecimals only applies to number axes by @helloigig in #8151
  • docs(www): group Guide navigation into sections by @PavelVanecek in #8154
  • feat(vr-gallery): add inspection tools and StackBlitz links by @Hanan88 in #8175
  • devops: upload reports from PRs from forks to Flakiness.io by @aslushnikov in #8180

New Contributors

Special thanks to @cloud-walker whos work on themes kickstarted 3.11

Full Changelog: v3.10.1...v3.11.0

Don't miss a new recharts release

NewReleases is sending notifications on new releases.