Stacked Area charts are displayed with several NAreaSeries objects. The MultiAreaMode property of the first area series must be set to MultiAreaMode.Series. The MultiAreaMode property of the subsequent area series must be set to MultiAreaMode.Stacked. The following example demonstrates how to create a stack area chart with two stacks:
C# |
Copy Code
|
---|---|
// obtain a reference to the Cartesian chart that is created by default NCartesianChart chart = (NCartesianChart)chartControl.Charts[0]; // create two area series NAreaSeries area1 = (NAreaSeries)chart.Series.Add(SeriesType.Area); NAreaSeries area2 = (NAreaSeries)chart.Series.Add(SeriesType.Area); // stack the second area over the first one area1.MultiAreaMode = MultiAreaMode.Series; area2.MultiAreaMode = MultiAreaMode.Stacked; |
Visual Basic |
Copy Code
|
---|---|
' obtain a reference to the Cartesian chart that is created by default Dim chart As NCartesianChart = chartControl.Charts(0) ' create two area series Dim area1 As NAreaSeries = chart.Series.Add(SeriesType.Area) Dim area2 As NAreaSeries = chart.Series.Add(SeriesType.Area) ' stack the second area over the first one 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 have to add the following code:
C# |
Copy Code
|
---|---|
NAreaSeries area4 = (NAreaSeries)chart.Series.Add(SeriesType.Area); NAreaSeries area5 = (NAreaSeries)chart.Series.Add(SeriesType.Area); area4.MultiAreaMode = MultiAreaMode.Series; area5.MultiAreaMode = MultiAreaMode.Stacked; |
Visual Basic |
Copy Code
|
---|---|
Dim area4 As NAreaSeries = chart.Series.Add(SeriesType.Area) Dim area5 As NAreaSeries = chart.Series.Add(SeriesType.Area) area4.MultiAreaMode = MultiAreaMode.Series area5.MultiAreaMode = MultiAreaMode.Stacked |