windowsforms-6167-controls-and-libraries-chart-control-series.md
The Series is the chart element that represents data within the Chart Control. The series’s view specifies the data’s appearance. The Series’s elements (Series Labels, Series Titles and others) display additional information about series’ data. For example, The Series Titles show series names and allow end-users to identify the pie series within the Chart Control. The Series also provides a filtering and sorting functionality to filter and sort data before visualization.
This topic consists of the following sections:
Use one of the following approaches to add a series to the chart:
Each chart can contain an unlimited number of series. You can click on a series to access it at design time .
Use the following code to get access to an individual series at runtime:
// The series collection provides two ways to get an item:
// By index;
Series indexedSeries = chartControl.Series[0];
// By series name (the Name property value);
Series indexedSeries = chartControl.Series["Series name"];
' The series collection provides two ways to get an item:
' By index;
Dim indexedSeries As Series = chartControl.Series(0)
' By series name;
Dim indexedSeries As Series = chartControl.Series("Series name")
The following table lists the properties used the code above:
| Symbol | Description |
|---|---|
| ChartControl.Series | Provides access to the chart control’s collection of series objects. |
| SeriesCollection.Item | Provides access to individual items that the collection stores. |
| Series.Name | Gets or sets the name of the series. |
The series obtains the data it visualizes in the following ways:
To change the series view at design time, select the series, locate the SeriesBase.View property in the Properties window and click the ellipsis button. In the invoked dialog window, select the series view and click OK.
Use the below code to change the series view at runtime:
series.View = new SplineSeriesView();
series.View = New SplineSeriesView
The code above uses the following classes and properties:
| Symbol | Description |
|---|---|
| SeriesBase.View | Gets or sets the view that the series uses to visualize its data. |
| SeriesViewBase | Represents the base class for all series view objects. |
Important
Series that the chart displays should have compatible series views. For example, the pie series view is not compatible with the area series view, and a chart cannot show these series simultaneously. In this case, the chart draws the first series in the collection.
The following series elements that display additional information about series’ data are customizable:
|
Element and Description
|
Sample Image
| | --- | --- | |
Text labels that represent point’s values, for example arguments or values in percent.
|
| |
Total Labels show Stacked Bar series groups’ summary values or all pie points’ summary value.
|
| |
The Series Title accompanies a series and usually displays the series name. The Series Titles are designed to allow end-users to distinguish several series that the chart displays simultaneously and are available only for series that use the Pie, Doughnut or Funnel series view.
|
| |
Indicators allow you to perform visual data analysis using the 2D XY-series data’s.
|
|