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:

NOTE
  • 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.

    create-series__properties-window

    Click Add... in the invoked Series Collection Editor dialog window.

    AddinSeries_1

    Then, select the series view type in the Choose Series View dialog and click OK to save the changes.

    Choose Series View

  • Using the Chart Designer

    Select the chart control, click its smart tag, and in the invoked actions list, click the Chart Designer... item.

    create-series__designer-smart-tag

    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.

    create-series__designer-add-series-button

  • Using the Smart Tag

    Select the chart control, click its smart tag, and in the invoked actions list, click the Series... item.

    AddinSeries_0

    Click Add... in the invoked Series Collection Editor.

    AddinSeries_1

    Then, select the series view type in the appeared Choose Series View dialog for the new series and click OK to perform selection.

    Choose Series View

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

After that fill a series with data using one of the ways: add points to a series manually or bind series to a data source.

The code above uses the following classes and members:

Symbol Description
Series Represents an individual series within a chart control.
ChartControl.Series Provides access to the chart control's collection of series objects.
See Also