Xceed Chart for WinForms v4.4 Documentation
Stacked Area

Welcome to Xceed Chart for WinForms v4.4 > User Guide > Series > XY Scatter Series > Area Series > Stacked Area

Stacked area charts are created by using several instances of the AreaSeries class. The first area series created must have its MultiAreaMode property set to Series. The MultiAreaMode property of the subsequent area series must be set to MultiAreaMode.Stacked. Stacked areas series are displayed on top of each other. The following figure shows a typical stack area chart: 



figure 1.

Creating the Stacked Area Series

The following example demonstrates how to create a stack area chart with two stacks:

VB.NET  

' there is one chart created by default

Dim chart As Chart = CType(chartControl1.Charts(0), Chart)

 

Dim area1 As AreaSeries = CType(chart.Series.Add(SeriesType.Area), AreaSeries)

Dim area2 As AreaSeries = CType(chart.Series.Add(SeriesType.Area), AreaSeries)

 

area1.MultiAreaMode = MultiAreaMode.Series

area2.MultiAreaMode = MultiAreaMode.Stacked

C#  
// there is one chart created by default
Chart chart = (Chart)chartControl1.Charts[0];
AreaSeries area1 = (AreaSeries)chart.Series.Add(SeriesType.Area);
AreaSeries area2 = (AreaSeries)chart.Series.Add(SeriesType.Area);
area1.MultiAreaMode = MultiAreaMode.Series;
area2.MultiAreaMode = MultiAreaMode.Stacked;

If you want to create a second stacked area with two stacks behind the stack area created in the previous sample, you must add the following code:

VB.NET  

Dim area4 As AreaSeries = CType(Chart.Series.Add(SeriesType.Area), AreaSeries)

Dim area5 As AreaSeries = CType(Chart.Series.Add(SeriesType.Area), AreaSeries)

 

area4.MultiAreaMode = MultiAreaMode.Series

area5.MultiAreaMode = MultiAreaMode.Stacked

C#  
AreaSeries area4 = (AreaSeries)Chart.Series.Add(SeriesType.Area);
AreaSeries area5 = (AreaSeries)Chart.Series.Add(SeriesType.Area);
area4.MultiAreaMode = MultiAreaMode.Series;
area5.MultiAreaMode = MultiAreaMode.Stacked;

Stack Origin

When an area series is stacked, it is always displayed with origin 0, regardless of the values of the UseOrigin and Origin properties.

Stacks with Negative Values

Stacked percent area charts do not support negative values, which means that all values are internally converted to their absolute value.

Stacked Area Formatting Commands

The following formatting commands inherited from the Series class have different meanings when an area series is stacked: 

<total> - Displays the absolute sum of the values in the current stack.
<cumulative> - Displays the sum of the values up to the current stack value.
<percent> - Displays the percent contribution of the value to the total pile sum. 

Related Examples

Windows Forms: Series\Area\Stacked Area

See Also

AreaSeries