Skip to main content

Full-Stacked Line Chart

  • 4 minutes to read

Short Description

The Full-Stacked Line Chart (100%-Stacked Line Chart) is represented by the FullStackedLineSeriesView object, which belongs to Point and Line Series Views. This chart is useful when it is necessary to compare how much each series adds to the total aggregate value for specific arguments.

A Full-Stacked Line chart is shown in the image below. Note that this chart type is based upon XYDiagram, and so it can be rotated to show lines either vertically or horizontally.

SeriesView_2DFullStackedLine

Note

A Full-Stacked Line chart can display series containing data points with positive or negative values. However, a series with positive values is stacked only with other series containing positive values; and a series with negative values is stacked with other series containing negative values.

Note that if a series contains data points with both positive and negative values, it is treated as a series with positive values, while all its negative values are treated as zeros.

Chart Type Characteristics

The table below lists the main characteristics of this chart type.

Feature Value
Series View type FullStackedLineSeriesView
Diagram type 2D-XYDiagram
Number of arguments per series point 1
Number of values per series point 1

Note

For information on which chart types can be combined with the Full-Stacked Line Chart, refer to the Series Views Compatibility document.

Example

The following example demonstrates how to create a ChartControl with a series of the FullStackedLineSeriesView type, and add this chart to a form at runtime. Before proceeding with this example, create a Windows Forms Application in Visual Studio, and add all required 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;

namespace FullStackedLineChart {
    public partial class Form1 : Form {
        public Form1() {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e) {

            // Create a new chart.
            ChartControl fullStackedLineChart = new ChartControl();

            // Create two full-stacked line series.
            Series series1 = new Series("Series 1", ViewType.FullStackedLine);
            Series series2 = new Series("Series 2", ViewType.FullStackedLine);

            // Add points to them.
            series1.Points.Add(new SeriesPoint(new DateTime(1997, 1, 11), 10));
            series1.Points.Add(new SeriesPoint(new DateTime(1999, 1, 11), 962));
            series1.Points.Add(new SeriesPoint(new DateTime(2001, 1, 11), 18832));
            series1.Points.Add(new SeriesPoint(new DateTime(2003, 1, 11), 264332));
            series1.Points.Add(new SeriesPoint(new DateTime(2005, 1, 11), 1112753));
            series1.Points.Add(new SeriesPoint(new DateTime(2007, 1, 11), 4169758));

            series2.Points.Add(new SeriesPoint(new DateTime(1997, 1, 11), 391));
            series2.Points.Add(new SeriesPoint(new DateTime(1999, 1, 11), 4082));
            series2.Points.Add(new SeriesPoint(new DateTime(2001, 1, 11), 21932));
            series2.Points.Add(new SeriesPoint(new DateTime(2003, 1, 11), 64195));
            series2.Points.Add(new SeriesPoint(new DateTime(2005, 1, 11), 78473));
            series2.Points.Add(new SeriesPoint(new DateTime(2007, 1, 11), 101830));

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

            // Access the type-specific options of the diagram.
            ((XYDiagram)fullStackedLineChart.Diagram).EnableAxisXZooming = true;
            ((XYDiagram)fullStackedLineChart.Diagram).AxisY.Label.TextPattern = "{VP:P0}";

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

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

            // Add the chart to the form.
            fullStackedLineChart.Dock = DockStyle.Fill;
            this.Controls.Add(fullStackedLineChart);
        }
    }
}