Skip to main content

SeriesPoint Class

Represents an individual series point.

Namespace: DevExpress.XtraCharts

Assembly: DevExpress.XtraCharts.v23.2.dll

NuGet Package: DevExpress.Charts

Declaration

public class SeriesPoint :
    ChartElement,
    ICustomTypeDescriptor,
    ISeriesPoint,
    ISeriesPointArgument,
    ISeriesPointValues,
    IDataPoint,
    IXtraSupportDeserializeCollectionItem

Remarks

The SeriesPoint class implements the functionality of an individual data point in a series. Each data point is defined by values of the following two types.

  • An X value that represents the point’s argument (it is specified by the point’s SeriesPoint.Argument property).
  • One or more Y values which represent the point’s value(s). This value(s) is stored within an array which can be accessed and customized via the SeriesPoint.Values property.

    Most series types use one value corresponding to each argument, which determine a point’s X and Y coordinates along a diagram’s axes. However, for some series types, multiple values correspond to a single argument (e.g. for Financial series four values are required: high, low, open and close, and Bubble series use two values one of which represents a point’s weight).

The visual representation of data points is specific to the view type of a series.

Data points that belong to the same series are stored within its Series.Points collection, represented by an instance of the SeriesPointCollection class. This collection provides the standard means for manipulating its items such as adding, removing and accessing them. A particular data point is available via the SeriesPointCollection.Item property of the collection, using indexer notation.

The length of an array that contains data values of a point can be obtained via the point’s SeriesPoint.Length property. An individual value of a data point can be accessed via the SeriesPoint.Values property using indexer notation (see the SeriesPoint.Item property).

Note that the SeriesBase.PointOptions property of a series allows you to customize the common appearance settings that define how data points are represented within the series.

The sequence in which series points are drawn corresponds to the order they have in the collection. However, data bound series may expose a more sophisticated drawing sequence (especially when complicated data bindings are involved, or events like ChartControl.BoundDataChanged are handled, and when the qualitative scale type is used). In such situations, if it’s required that series points are drawn in a strictly determined sequence, this can be achieved by adding a static series with points arranged in the required way, and setting this series as the first item in the collection.

Series points can be sorted dependent on either their values, or arguments. For details on this, refer to Sorting Data.

For more information, refer to Series Points.

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);
        }

    }
}

Inheritance

See Also