Back to Devexpress

SeriesPoint Class

corelibraries-devexpress-dot-xtracharts-7c14172a.md

latest11.1 KB
Original Source

SeriesPoint Class

Represents an individual series point.

Namespace : DevExpress.XtraCharts

Assembly : DevExpress.XtraCharts.v25.2.dll

NuGet Package : DevExpress.Charts

Declaration

csharp
public class SeriesPoint :
    ChartElement,
    ICustomTypeDescriptor,
    ISeriesPoint,
    ISeriesPointArgument,
    ISeriesPointValues,
    IDataPoint,
    IXtraSupportDeserializeCollectionItem
vb
Public Class SeriesPoint
    Inherits ChartElement
    Implements ICustomTypeDescriptor,
               ISeriesPoint,
               ISeriesPointArgument,
               ISeriesPointValues,
               IDataPoint,
               IXtraSupportDeserializeCollectionItem

The following members return SeriesPoint objects:

Show 12 links

LibraryRelated API Members
Cross-Platform Class LibraryChartHitInfo.SeriesPoint
CrosshairElement.SeriesPoint
CrosshairLegendElement.SeriesPoint
CustomDrawSeriesPointEventArgs.SeriesPoint
ExplodedSeriesPointCollection.Item[Int32]
PieSeriesPointExplodedEventArgs.Point
Relation.ChildPoint
Relation.ParentPoint
SeriesPoint.CreateSeriesPointWithId(Object, Int32)
SeriesPointAnchorPoint.SeriesPoint
SeriesPointCollection.Item[Int32]
WinForms ControlsRelationSeriesPointModel.SeriesPointModel

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.

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).

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.

Note

A complete sample project is available at https://github.com/DevExpress-Examples/winforms-charts-create-side-by-side-bar-chart

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

    }
}
vb
Imports System
Imports System.Windows.Forms
Imports DevExpress.XtraCharts
' ...

Namespace SideBySideBar2D
    Partial Public Class Form1
        Inherits Form

        Public Sub New()
            InitializeComponent()
        End Sub

        Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load
            ' Create an empty chart.
            Dim sideBySideBarChart As New ChartControl()

            ' Create the first side-by-side bar series and add points to it.
            Dim series1 As 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.
            Dim series2 As 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).
            CType(sideBySideBarChart.Diagram, XYDiagram).Rotated = True

            ' Add a title to the chart (if necessary).
            Dim chartTitle1 As New ChartTitle()
            chartTitle1.Text = "Side-by-Side Bar Chart"
            sideBySideBarChart.Titles.Add(chartTitle1)

            ' Add the chart to the form.
            sideBySideBarChart.Dock = DockStyle.Fill
            Me.Controls.Add(sideBySideBarChart)
        End Sub

    End Class
End Namespace

Implements

IXtraSupportDeserializeCollectionItem

Inheritance

Object ChartElement SeriesPoint

See Also

SeriesPoint Members

Item[Int32]

Series Points

DevExpress.XtraCharts Namespace