Stacked Line charts are displayed with several NLineSeries objects. The MultiLineMode property of the first line series must be set to MultiLineMode.Series. The MultiLineMode property of the subsequent line series must be set to MultiLineMode.Stacked. The following example demonstrates how to create a stack line 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];
NLineSeries line1 = (NLineSeries)chart.Series.Add(SeriesType.Line);
NLineSeries line2 = (NLineSeries)chart.Series.Add(SeriesType.Line);
line1.MultiLineMode = MultiLineMode.Series;
line2.MultiLineMode = MultiLineMode.Stacked;
|
Visual Basic |
Copy Code
|
---|---|
' obtain a reference to the Cartesian chart that is created by default Dim chart As NCartesianChart = chartControl.Charts(0) Dim line1 As NLineSeries = chart.Series.Add(SeriesType.Line) Dim line2 As NLineSeries = chart.Series.Add(SeriesType.Line) line1.MultiLineMode = MultiLineMode.Series line2.MultiLineMode = MultiLineMode.Stacked |
If you want to create a second stacked line with two stacks behind the stack line created in the previous sample you must add the following code:
C# |
Copy Code
|
---|---|
NLineSeries line4 = (NLineSeries)chart.Series.Add(SeriesType.Line); NLineSeries line5 = (NLineSeries)chart.Series.Add(SeriesType.Line); line4.MultiLineMode = MultiLineMode.Series; line5.MultiLineMode = MultiLineMode.Stacked; |
Visual Basic |
Copy Code
|
---|---|
Dim line4 As NLineSeries = chart.Series.Add(SeriesType.Line) Dim line5 As NLineSeries = chart.Series.Add(SeriesType.Line) line4.MultiLineMode = MultiLineMode.Series line5.MultiLineMode = MultiLineMode.Stacked |