Skip to main content
A newer version of this page is available. .

SeriesBase Class

Represents a base class for series objects and contains template settings for data bound series.

Namespace: DevExpress.XtraCharts

Assembly: DevExpress.XtraCharts.v20.1.dll

NuGet Packages: DevExpress.Charts, DevExpress.WindowsDesktop.Charts

Declaration

public class SeriesBase :
    ChartElement,
    ISeriesBase,
    ISeriesDataAdapter,
    ISeriesPointFactory,
    IHitTest,
    IXtraSupportCreateContentPropertyValue,
    IXtraSupportDeserializeCollectionItem,
    ITopNOptions,
    IPointsFilterOptions,
    ICheckableLegendItem,
    ILegendItem,
    IFilteredComponent,
    IFilteredComponentBase,
    IFilteringUIClient,
    IFilterCriteriaBindingAware

The following members return SeriesBase objects:

Library Related API Members
Cross-Platform Class Library ChartHitInfo.Series
WinForms Controls SnapChart.SeriesTemplate

Remarks

The SeriesBase class is used to realize two main functions within a chart control’s object hierarchy.

  1. The SeriesBase class serves as a base for the Series class.

    The settings implemented by the SeriesBase class define the core functionality of the series objects which are created explicitly within a chart control (either at design or runtime) and are contained within its ChartControl.Series collection.

  2. The SeriesBase class serves as a template for series which are created dynamically.

    When data binding is performed at the level of a chart control (via the ChartControl.DataSource and ChartControl.SeriesDataMember properties), the SeriesBase class contains pattern settings that are applied to all the series which are created dynamically based upon the data taken from the specified data source. Since these series are not added to a chart control’s ChartControl.Series collection, and can’t be accessed and customized at that level, an instance of the SeriesBase class is exposed via the ChartControl.SeriesTemplate property to provide centralized control over the bound series’ customization.

The main members exposed by the SeriesBase class allow you to perform the following customizations.

Example

The following example demonstrates how to create a ChartControl with two series of the SideBySideBarSeriesView 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;
// ...

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

        private void Form1_Load(object sender, EventArgs e) {
            // Create an empty chart.
            ChartControl sideBySideBarChart = new ChartControl();

            // Create the first side-by-side bar series and add points to it.
            Series series1 = new Series("Side-by-Side Bar Series 1", ViewType.Bar);
            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));

            // Create the second side-by-side bar series and add points to it.
            Series series2 = new Series("Side-by-Side Bar Series 2", ViewType.Bar);
            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 the series to the chart.
            sideBySideBarChart.Series.Add(series1);
            sideBySideBarChart.Series.Add(series2);

            // Hide the legend (if necessary).
            sideBySideBarChart.Legend.Visibility = DevExpress.Utils.DefaultBoolean.False;

            // Rotate the diagram (if necessary).
            ((XYDiagram)sideBySideBarChart.Diagram).Rotated = true;

            // Add a title to the chart (if necessary).
            ChartTitle chartTitle1 = new ChartTitle();
            chartTitle1.Text = "Side-by-Side Bar Chart";
            sideBySideBarChart.Titles.Add(chartTitle1);

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

    }
}
See Also