StackedBarSeriesView Class

Represents a series view of the Stacked Bar type.

Namespace: DevExpress.XtraCharts

Assembly: DevExpress.XtraCharts.v21.1.dll


public class StackedBarSeriesView :


The StackedBarSeriesView class provides the functionality of a series view of the stacked bar type within a chart control. At the same time, the StackedBarSeriesView class serves as a base for the FullStackedBarSeriesView class.

The StackedBarSeriesView class inherits properties and methods from the base BarSeriesView class which define the common settings of bar series views.

Note that a particular view type can be defined for a series via its SeriesBase.View property.

For more information on series views of the stacked bar type please see the Stacked Bar Chart topic.


The following example demonstrates how to create a ChartControl with two series of the StackedBarSeriesView type, and add this chart to a form at runtime. Before proceeding with this example, first create a Windows Forms Application in Visual Studio, and include all necessary assemblies to the References list of your project.

Then, add the following code to the Form.Load event handler.

using System;
using System.Windows.Forms;
using DevExpress.XtraCharts;
// ...

private void Form1_Load(object sender, EventArgs e) {
    // Create a new chart.
    ChartControl stackedBarChart = new ChartControl();

    // Create two stacked bar series.
    Series series1 = new Series("Series 1", ViewType.StackedBar);
    Series series2 = new Series("Series 2", ViewType.StackedBar);

    // Add points to them
    series1.Points.Add(new SeriesPoint("A", 10));
    series1.Points.Add(new SeriesPoint("B", 12));
    series1.Points.Add(new SeriesPoint("C", 14));
    series1.Points.Add(new SeriesPoint("D", 17));

    series2.Points.Add(new SeriesPoint("A", 15));
    series2.Points.Add(new SeriesPoint("B", 18));
    series2.Points.Add(new SeriesPoint("C", 25));
    series2.Points.Add(new SeriesPoint("D", 33));

    // Add both series to the chart.
    stackedBarChart.Series.AddRange(new Series[] { series1, series2 });

    // Access the view-type-specific options of the series.
    ((StackedBarSeriesView)series1.View).BarWidth = 0.8;

    // Access the type-specific options of the diagram.
    ((XYDiagram)stackedBarChart.Diagram).EnableAxisXZooming = true;

    // Hide the legend (if necessary).
    stackedBarChart.Legend.Visible = false;

    // Add a title to the chart (if necessary).
    stackedBarChart.Titles.Add(new ChartTitle());
    stackedBarChart.Titles[0].Text = "A Stacked Bar Chart";

    // Add the chart to the form.
    stackedBarChart.Dock = DockStyle.Fill;
See Also