Back to Devexpress

Create a Series Manually

windowsforms-5795-controls-and-libraries-chart-control-provide-data-create-a-series-manually.md

latest3.4 KB
Original Source

Create a Series Manually

  • Aug 13, 2021
  • 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

  • Using the Chart Designer

  • Using the Smart Tag

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:

csharp
// 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);
vb
' The series has the constructor that specifies the view
' that the series would use.
Dim series As 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:

SymbolDescription
SeriesRepresents an individual series within a chart control.
ChartControl.SeriesProvides access to the chart control’s collection of series objects.

See Also

Sorting Data

Data Aggregation

Specify Series View Color

How to: Custom Draw Series