Stacked Percent Bar charts are displayed with several NBarSeries objects. The MultiBarMode property of the first bar series must be set to MultiBarMode.Series. The MultiBarMode property of the subsequent bar series must be set to MultiBarMode.StackedPercent. The following example demonstrates how to create a stacked percent bar chart with three stacks:
C# |
Copy Code
|
---|---|
// obtain a reference to the Cartesian chart that is created by default
NCartesianChart chart = (NCartesianChart)chartControl.Charts[0];
NBarSeries bar1 = (NBarSeries)chart.Series.Add(SeriesType.Bar);
NBarSeries bar2 = (NBarSeries)chart.Series.Add(SeriesType.Bar);
NBarSeries bar3 = (NBarSeries)chart.Series.Add(SeriesType.Bar);
bar1.MultiBarMode = MultiBarMode.Series;
bar2.MultiBarMode = MultiBarMode.StackedPercent;
bar3.MultiBarMode = MultiBarMode.StackedPercent;
|
Visual Basic |
Copy Code
|
---|---|
' obtain a reference to the Cartesian chart that is created by default Dim chart As NCartesianChart = chartControl.Charts(0) Dim bar1 As NBarSeries = chart.Series.Add(SeriesType.Bar) Dim bar2 As NBarSeries = chart.Series.Add(SeriesType.Bar) Dim bar3 As NBarSeries = chart.Series.Add(SeriesType.Bar) bar1.MultiBarMode = MultiBarMode.Series bar2.MultiBarMode = MultiBarMode.StackedPercent bar3.MultiBarMode = MultiBarMode.StackedPercent |