2D Chart for WinForms | ComponentOne
Charting Data / Defining the Chart Data Objects / Defining the ChartDataSeries Object
In This Topic
    Defining the ChartDataSeries Object
    In This Topic

    One of the more important objects in C1Chart is the ChartDataSeries. The data series contains all of the data to be included in the chart and many important data-related properties.

    The ChartDataSeries is contained in the SeriesList collection of the ChartData object, which is an object of the ChartGroup:

    To write code in Visual Basic

    Visual Basic
    Copy Code
    C1Chart1.ChartGroups.ChartGroupsCollection(0).ChartData.SeriesList(0)
    

    To write code in C#

    C#
    Copy Code
    c1Chart1.ChartGroups.ChartGroupsCollection[0].ChartData.SeriesList[0];
    

    The series object is crucial for data and data access for two reasons:

    1. First, the number of series in the SeriesList collection of the ChartData object determines the number of data series to be displayed in the chart. If five sets of plots in an X-Y chart are desired, then there should be five series in the SeriesList.
    2. Secondly, the number of values specified in the X, Y, and Y1, Y2, Y3 ChartDataArray objects within the series determine how many points that series will have and how it will be charted. If the chart has ten values in both the X and Y array objects for Series 0, and 5 values in both the X and Y arrays for Series 1, then the first series will have ten points and the second series will have five.

    Note that the number of points in a series is the number of elements of the longest data array object applicable to the series. For example, an XY-Plot uses X and Y arrays. If X has five elements and Y has three elements, then the number of points is five, and the last two elements of Y are assumed to be data holes. Even if the Y1 array has ten elements, the number of points is five because an XY-Plot does not use the Y1 array. However, if the chart type is changed to HiLo, then X, Y and Y1 are all used and so the number of points would be ten, and both the X and Y arrays would be assumed to contain data holes in the missing elements.

    See Also