Back to Devexpress

Series.Points Property

corelibraries-devexpress-dot-xtracharts-dot-series-a9eadf27.md

latest12.4 KB
Original Source

Series.Points Property

Gets the series’ collection of data points.

Namespace : DevExpress.XtraCharts

Assembly : DevExpress.XtraCharts.v25.2.dll

NuGet Package : DevExpress.Charts

Declaration

csharp
[PersistenceMode(PersistenceMode.InnerProperty)]
[XtraChartsLocalizableCategory(XtraChartsCategory.Elements)]
public SeriesPointCollection Points { get; }
vb
<XtraChartsLocalizableCategory(XtraChartsCategory.Elements)>
<PersistenceMode(PersistenceMode.InnerProperty)>
Public ReadOnly Property Points As SeriesPointCollection

Property Value

TypeDescription
SeriesPointCollection

A SeriesPointCollection object that represents the data point collection of the series.

|

Remarks

The Points property provides access to a collection of data points that belong to an individual series. The SeriesPointCollection class represents the series point collection and allows you to manage (add, remove, access via indexer notation, etc.) individual series points (instances of the SeriesPoint class) within the collection.

Important

The series Points collection may provide series points that represent data source objects. These points are generated on the first getting of series points. For performance reasons, it is strongly recommended not to request series points when the series is data bound.

The Chart Control does not generate series points until it loads a data source. Use the ChartControl.BoundDataChanged (WebChartControl.BoundDataChanged or ChartControlSettings.BoundDataChanged) event to obtain a collection of generated points.

The series can sort its points that have qualitative arguments before displaying them using the SeriesBase.SeriesPointsSorting) and SeriesBase.SeriesPointsSortingKey properties. Refer to the Sorting Data guide for more information.

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

The following code snippets (auto-collected from DevExpress Examples) contain references to the Points property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

winforms-charts-sort-stacked-bars-by-total-values-with-qualitativescalecomparer/CS/Form1.cs#L56

csharp
foreach (Series series in chartControl1.Series)
    foreach (SeriesPoint point in series.Points)
        if (Equals(point.Argument,arg))

winforms-chart-create-a-3d-pie-chart/CS/3DPieChart/Form1.cs#L37

csharp
((Pie3DSeriesView)series1.View).Depth = 30;
((Pie3DSeriesView)series1.View).ExplodedPoints.Add(series1.Points[0]);
((Pie3DSeriesView)series1.View).ExplodedDistancePercentage = 30;

winforms-charts-configure-swift-plot-chart/CS/ASwiftPlotChart/Form1.cs#L48

csharp
int pointsToRemoveCount = 0;
foreach (SeriesPoint point in series1.Points)
    if (point.DateTimeArgument < minDate)

winforms-charts-sort-stacked-bars-by-total-values-with-qualitativescalecomparer/VB/Form1.vb#L56

vb
For Each series As Series In chartControl1.Series
    For Each point As SeriesPoint In series.Points
        If Equals(point.Argument, arg) Then

winforms-chart-accompany-chart-elements-by-text-or-image-annotations/VB/AnnotationsSample/Form1.vb#L26

vb
' This adds the annotation to the series point's Annotations collection.
chartControl1.AnnotationRepository(0).AnchorPoint = New SeriesPointAnchorPoint(chartControl1.Series(0).Points(2))
' Now, create an image annotation, and add it to the chart's collection.

winforms-chart-create-a-3d-pie-chart/VB/3DPieChart/Form1.vb#L35

vb
CType(series1.View, Pie3DSeriesView).Depth = 30
CType(series1.View, Pie3DSeriesView).ExplodedPoints.Add(series1.Points(0))
CType(series1.View, Pie3DSeriesView).ExplodedDistancePercentage = 30

winforms-chart-create-a-doughnut-chart/VB/Series_DoughnutChart/Form1.vb#L40

vb
' Adjust the view-type-specific options of the series.
CType(series1.View, DoughnutSeriesView).ExplodedPoints.Add(series1.Points(0))
CType(series1.View, DoughnutSeriesView).ExplodedDistancePercentage = 30

winforms-charts-configure-swift-plot-chart/VB/ASwiftPlotChart/Form1.vb#L52

vb
Dim pointsToRemoveCount As Integer = 0
For Each point As SeriesPoint In series1.Points
    If point.DateTimeArgument < minDate Then pointsToRemoveCount += 1

See Also

SeriesPointCollection

SeriesPoint

ChartControl.CustomDrawSeriesPoint

WebChartControl.CustomDrawSeriesPoint

ChartControlSettings.CustomDrawSeriesPoint

Series Class

Series Members

DevExpress.XtraCharts Namespace