Create a Series Manually
- 3 minutes to read
This document describes how to add a new series to the chart manually and consists of the following sections:
- All series that the chart displays should have compatible series views. The first series's view defines the available series view groups the chart can display and specifies the chart's diagram type. Series with an incompatible view are not displayed.
- The chart's legend shows series in the order they appear in the chart's ChartControl.Series collection.
Create a Series at Design Time
Use one of following approaches to add a series at design time:
Using the Properties Window
Select the chart control, locate the ChartControl.Series property in the Properties window and click its ellipsis button.
Click Add... in the invoked Series Collection Editor dialog window.
Then, select the series view type in the Choose Series View dialog and click OK to save the changes.
Using the Chart Designer
Select the chart control, click its smart tag, and in the invoked actions list, click the Chart Designer... item.
Locate the series in the invoked Chart Designer's chart element tree and click the + button. Select the series view type in the drop-down list.
Using the Smart Tag
Select the chart control, click its smart tag, and in the invoked actions list, click the Series... item.
Click Add... in the invoked Series Collection Editor.
Then, select the series view type in the appeared Choose Series View dialog for the new series and click OK to perform selection.
Note that series are only displayed if they have at least one data point. The Chart control provides two approaches to populate the series with points:
Create a Series at Runtime
The following code demonstrates how to add a series at runtime manually:
// The series has the constructor that specifies the view // that the series would use. Series series = new Series("2015", ViewType.Bar); chartControl.Series.Add(series);
The code above uses the following classes and members:
|Series||Represents an individual series within a chart control.|
|ChartControl.Series||Provides access to the chart control's collection of series objects.|