Home›Area›Stacked Area Chart
Area

Stacked Area Chart

Multiple area series stacked on top of each other to show cumulative totals over time.

Loading chart…
#area#stacked#cumulative#total
Customization Guides & Code Snippets

◆Configuring Stacked Series with stackId

Give all <Area> components the same stackId='1' prop to stack them cumulatively on top of one another.

<Area type="monotone" dataKey="organic" stackId="1" stroke="#00e5a0" fill="#00e5a0" fillOpacity={0.6} />
<Area type="monotone" dataKey="paid" stackId="1" stroke="#4a9eff" fill="#4a9eff" fillOpacity={0.6} />

◆Excel vs React Recharts Implementation

Unlike Excel where stacked area series require manual table transposition, Recharts naturally stacks any array of objects using simple dataKey bindings and stackId matching.

When to use a Stacked Area Chart

A Stacked Area Chart is ideal for developers and designers who need to display data clearly and effectively. Use this chart type when:

  • ✓Showing volume trends over time (e.g. cumulative revenue)
  • ✓Comparing two or more metrics with stacked areas
  • ✓Highlighting the magnitude of change, not just direction
  • ✓Displaying website traffic patterns over weeks or months
Tips for Recharts Stacked Area Chart
TIP 1Use gradient fills (linearGradient) to reduce visual weight at the bottom
TIP 2Stacked areas work well for showing cumulative totals
TIP 3Set fillOpacity between 0.2–0.4 to keep the chart readable
TIP 4Combine with a Line component on top for a cleaner stroke
TIP 5Use syncId to sync multiple area charts that share the same X axis
Key Recharts Props
PROPTYPEDESCRIPTION
dataarrayArray of objects with your data values
dataKeystringThe key in your data objects for area values
strokestringLine color for the top edge
fillstringFill color — use 'url(#gradientId)' for gradients
stackIdstringStack multiple areas with the same stackId
typestringCurve type: 'monotone' recommended for smooth areas
Frequently Asked Questions

What is a stacked area chart?

A stacked area chart displays multiple series stacked one on top of the other, showing both the total cumulative trend and the individual contribution of each component series over time.

How does a stacked area chart in React Recharts compare to Microsoft Excel?

In Microsoft Excel, stacked area charts often require dedicated table formatting and rigid formatting dialogs. In React with Recharts, stacking is completely dynamic: assigning stackId='1' to any series automatically stacks the areas with full responsiveness, smooth monotone interpolation, custom SVG gradients, and dark-mode compatibility.

Can stacked area charts handle negative values?

In general, stacked area charts work best with non-negative values because stacking positive and negative areas can lead to overlapping visual occlusions. For datasets with significant positive and negative swings, a clustered bar chart or dual-axis line chart is usually recommended.

Related Charts