Xceed Chart for WinForms v4.4 Documentation
Stacked Percent Area

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

Stacked percent areas 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 StackedPercent. Stacked percent area series are displayed on top of each other, and all stacks begin at 0 and end at 1. The following figure shows a typical stack percent area chart: 



figure 1.

Creating the Stacked Percent Area Series

The following example demonstrates how to create a stacked percent area chart with three 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)

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

 

area1.MultiAreaMode = MultiAreaMode.Series

area2.MultiAreaMode = MultiAreaMode.StackedPercent

area3.MultiAreaMode = MultiAreaMode.StackedPercent

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);
AreaSeries area3 = (AreaSeries)chart.Series.Add(SeriesType.Area);
area1.MultiAreaMode = MultiAreaMode.Series;
area2.MultiAreaMode = MultiAreaMode.StackedPercent;
area3.MultiAreaMode = MultiAreaMode.StackedPercent;

Stacked Percent Scaling

When an area series is displayed in stacked percent mode, the min value of the series is always 0, and the max value of the series is always 1. In order to display the texts on the PrimaryY axis as percent values, you must use the following code:

VB.NET  
chart.Axis(StandardAxis.PrimaryY).ValueFormat.Format = ValueFormat.Percentage
C#  
chart.Axis(StandardAxis.PrimaryY).ValueFormat.Format = ValueFormat.Percentage;

Stacked Percent Series 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 Percent 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